YT2Invidio

Point YouTube links to Invidious, Twitter to Nitter, Instagram to Bibliogram, Reddit to Teddit, Medium to Scribe

< Feedback on YT2Invidio

Question/comment

§
Posted: 11. 03. 2020

redirect instagram links to bibliogram

https://bibliogram.art

https://github.com/cloudrac3r/bibliogram

IzzySoftAuthor
§
Posted: 11. 03. 2020

I use neither, so I cannot really test this. What do "real links" look like? I.e. "original InstaLink" => "resulting BiblioLink"? Can you give a few examples? And are there also multiple bibliogram instances, so the base URL should be configurable?

No promises as for when I find time to add this (I'm currently quite occupied at work), but I can add it to the todo list.

§
Posted: 13. 03. 2020

profile

https://www.instagram.com/joerogan/

https://bibliogram.art/u/joerogan

post

www.instagram.com/p/B9pqv10FsZH/

https://bibliogram.art/p/B9pqv10FsZH/

list of instances

https://github.com/cloudrac3r/bibliogram/wiki/Instances

Array.from(document.links).forEach(elem => {
        // profile
        if (elem.href.match(/(www\.)?instagram\.com\/p\/([^&#]+)/i)) {
          if (location.hostname != "bibliogram.art") {
            elem.href = "https://bibliogram.art/p/" + RegExp.$2;
          }

          // image or video
        } else if (elem.href.match(/(www\.)?instagram\.com\/([^&#]+)/i)) {
          if (location.hostname != "bibliogram.art") {
            elem.href = "https://bibliogram.art/u/" + RegExp.$2;
          }
        }
      });
IzzySoftAuthor
§
Posted: 13. 03. 2020

Thanks!

IzzySoftAuthor
§
Posted: 14. 03. 2020

I've created an issue for it and hopefully will be working on it soon.

IzzySoftAuthor
§
Posted: 14. 03. 2020

Faster than I thought: v1.2.6 now also rewrites Instagram links to the chosen Bibliogram site (default "bibliogram.art") – with userscript menu items to show the list of available instances and switch to another, if preferred.

Can you please test and report back if it works for you? I don't use Insta/Biblio and had no page to test with.

§
Posted: 18. 03. 2020

it's working great, thank you

using instances with https:// or / at the end gives an error it would be nice if the script remove it automatically

IzzySoftAuthor
§
Posted: 18. 03. 2020
Edited: 18. 03. 2020

Glad to hear! What do you mean by "using instances with https … gives an error"? Trailing slash I understand (and removing that shouldn't be too hard – edit: done already, waiting for the other part before I release). Your examples above gave the link with https://, like https://bibliogram.art/p/ – so I don't understand what's wrong with that.

Btw: bibiogram.art currently gives a 502 (bad gateway), or is that just me?

§
Posted: 23. 03. 2020

when changing the instance to https//bibliogram.pussthecat.org/ the link become

https://https//bibliogram.pussthecat.org//u/joerogan

IzzySoftAuthor
§
Posted: 23. 03. 2020

Yes. Omit the protocol, just enter the hostname – e.g. "bibliogram.pussthecat.org". As the example shows when that popup opens.

§
Posted: 23. 03. 2020

it would be nice if the script does that automatically

IzzySoftAuthor
§
Posted: 23. 03. 2020

Yes, it would. But I prefer to keep it simple. I'm not a big Javascript nerd :wink:

I could see if I can come up with a nice&easy RegEx when I have time – but that might introduce more problems than it solves. What cases should be covered, and what combinations? stripping everything to the first slash would clean e.g. http://example.com and //example.com – but mess up example.com/, etc. Cannot use a regular URL parser either, as that might fail if only passed a hostname…

I'll ponder a bit on it and see what can be done. Will take a little, though; currently having 10..12h shifts and don't feel much like tampering with more code afterwards (so if you have an idea, it's welcome). Give me a little time, feel free to send a heads-up in 2+ weeks if I didn't send an update. Deal?

IzzySoftAuthor
§
Posted: 23. 03. 2020

Ha! My RegEx-Fu didn't leave me. Watch out for the update, it's already checked-in to the repo o:)

Post reply

Sign in to post a reply.