General URL Cleaner

Cleans URL's from various popular sites.

< General URL Cleanerについてのフィードバック

質問/コメント

§
投稿日: 2015/08/04

On Youtube, page links with redirect (

image Opera 31.0.1889.98 beta/Tampermonkey

Knowbody作者
§
投稿日: 2015/08/12

I've never actually seen a youtube redirect link like that before.

I think should work with this regex:

var youtubeRedirectLink = new RegExp(/^https?:\/\/www.youtube.com\/redirect\?q\=/);

And this case in the main cleaning function:

        case youtubeRedirectLink.test(oldurl):
            decodeURIComponent(oldurl.replace(youtubeRedirectLink,'').replace(/\&redir_token\=.*/,''));
            break;
§
投稿日: 2015/08/17

And this case in the main cleaning function:

It did not help me ( image

But the script YouTube Link Cleaner works, probably necessary to delete class="yt-uix-redirect-link" image

Knowbody作者
§
投稿日: 2015/08/22
編集日: 2015/08/22

I figured out why that script works and mine doesn't: There seems to be a script on youtube that keeps changing the links to a redirect link. And the script you linked keeps running the cleaning function every second, using window.setInterval(ChangeLinks, 1000);

I'd rather try to use something like MutationObserver to detect when the links are modified, and modify them back, so that it doesn't eat CPU time running the function over and over again if it doesn't have to.

edit

Scratch that, I noticed that the links don't actually change until you click on them. And all I need to do is remove the class to prevent them from doing so. I just added this and it seems to work:

else if(links[i].class="yt-uix-redirect-link") links[i].removeAttribute("class");

And it doesn't have to keep observing page changes or run the function again.

§
投稿日: 2015/08/23
編集日: 2015/08/23

cratch that, I noticed that the links don't actually change until you click on them. And all I need to do is remove the class to prevent them from doing so. I just added this and it seems to work:

No ( Redirects remain in the current version. In previous (2.0.3.2 w/o youtube player control) - no redirects.

ps. But in FF v40.0.2 works now, unlike Opera v32,33 or Chrome v44

Knowbody作者
§
投稿日: 2015/08/23
編集日: 2015/08/23

OK, it looks like:

if (links[i].className.contains("yt-uix-redirect-link")

Only works in Firefox, while:

if (links[i].class="yt-uix-redirect-link")

Seems to work in Firefox and Opera.

In the version where youtube HTML5 player controls disappeared, it was just removing the class property from all page links.

§
投稿日: 2015/08/24

In the version where youtube HTML5 player controls disappeared, it was just removing the class property from all page links.

Again youtube play controls removed in Opera/Chrome/FF \

Knowbody作者
§
投稿日: 2015/08/24
編集日: 2015/08/24

OK, I'm not gonna lie, this has actually been kinda pissing me off. But I think I've finally got it:

if (/ytp-button$/.test(links[i].className) == false) links[i].removeAttribute('class');

I tested that in Opera and Firefox.

I still don't know why it was breaking the HTML5 player buttons with

if (links[i].class="yt-uix-redirect-link")

given that they don't actually have that class name.

§
投稿日: 2015/08/24

But I think I've finally got it:

Yes, with Youtube all ok now, thanks. But all links to amazon in google search result now look so (checked on Opera & FF): image

Knowbody作者
§
投稿日: 2015/08/24

I remember fixing that one on Amazon's own website, but looks like I forgot to do it for google and bing.

§
投稿日: 2015/08/26

New version - on Opera/Chrome again youtube redirects \

Knowbody作者
§
投稿日: 2015/08/26
編集日: 2015/08/26

I forgot to actually put in the youtubeClasses regex I made on greasyfork. I'm annoyed at myself for that.

返信を投稿

返信を投稿するにはログインしてください。