Closed fwenzel closed 8 years ago
rel=
are fairly standard, so happy to parse those. Reuters data attribute might be Reuters specific, which I don't mind per se but would be the first foray into site-specific options, which I am at least a tiny little bit concerned about.
Thanks for being open for suggestions. It took me a while to notice that there are more short urls than copy-shorturl copies. So I started to look for short urls in the html of pages. Perhaps I'll find even more variants. The Reuters short link attributes are not in the header. I found them in a div element in the body. Many big media have their own shortlinks. I'll take a better look on it and will come back, if I find something else.
It would be great to catch all this genuine short urls, because I do not like url shorteners much. ur1.ca even bans me from time to time as they work with spamhouse blacklist and stupidly block IPs. Works rather reliable with everything from Syria, no matter whether it is related to Assad or to the democratic opposition. Censuring should be the least, url shorteners do. Sorry for that little novel.
No you're totally right -- and I'd love to match most short URLs on sites if they can be detected somehow. Special per-site rules aren't out of the question after all -- I could even have a JSON file that the add-on auto updates from the Internet on occasion. Haven't thought about it much. Just maintaining it long term would be complicated.
Covering a lot of options now: https://github.com/fwenzel/copy-shorturl/blob/master/src/data/js/find-short-url.js#L1-L4
Site-specifics are out of scope for now, but I am still open to suggestions on important sites (which) and what we might want to do with them specifically.
I think I changed my mind. For certain sites it might make total sense to enable arbitrary selectors? NY times, for instance has: <span class="story-short-url"><a href="http://nyti.ms/2cjHxN9">http://nyti.ms/2cjHxN9</a></span></header>
The Guardian has stuff like "shortUrl":"https://gu.com/p/525m7
in the source. - Let users contribute.
Thank you for the suggestions! I figure if I make the format straightforward it should be pretty easy to contribute a patch.
From https://twitter.com/vegos/status/648646007136382976