Remove redirects on YahooJP

chbataka

Beta Tester
On yahoo.co.jp, redirects are used to track users and it annoys me. I'd appreciate your making filter(s) that works at "*.yahoo.co.jp".

I wrote two filters to accomplish the purpose, but it didn't worked. I checked the codes on regexr.com and worked at there. Maybe you need to remove JSs from the source or insert JSs to *.yahoo.co.jp/.

My codes:
Code:
://search.yahoo.co.jp/$replace=/(<a\shref="(http|https):\/\/(wrs|rd|ord)\.search\.yahoo\.co\.jp\/.+?)((http|https)%3a\/\/.+?)"/$4/ig

://search.yahoo.co.jp/$replace=/(<a\shref="(http|https):\/\/.+?")\s(onmousedown|onclick)=".+?"/$1/ig
In 2011, @abp_jp on twitter wrote an code which works on Privoxy, and I changed it for Adguard, but didn't worked.
Code:
://search.yahoo.co.jp/$replace=/(<a\s+[^>]*href\s*=\s*["'])https?:\/\/(?:\w*rd|wrs\.search)\.yahoo\.co\.jp/[^*?]+[*?]+-?(https?)(?:%3A|:)(//[^"']+)(["'][^>]*>.*</a[^>]*>)/$1$2:$3$4\/igs



Sample sites: (Please check mobile pages!)
http://search.yahoo.co.jp/search?&ei=UTF-8&p=android
http://search.yahoo.co.jp/search?&ei=UTF-8&p=東京オリンピック


I am using AG for Android.
 

Blaz

Moderator & Translator
Staff member
Moderator
Can you please post one url which should be replaced with which content. Much easier to understand that way.
 

chbataka

Beta Tester
Can you please post one url which should be replaced with which content. Much easier to understand that way.
All links should be replaced on http://search.yahoo.co.jp/search?&ei=UTF-8&p=*.

(Be sure to check on mobile device! I'm using Habit browser on Android 5.0.2, but you'll get same results in many browsers except Chrome on Android.)
For example on http://search.yahoo.co.jp/search?&ei=UTF-8&p=android,
The first search result links go to
Code:
http://wrs.search.yahoo.co.jp/*https://www.android.com/intl/ja_jp/
at first and then redirected to
Code:
https://www.android.com/intl/ja_jp/
I need to remove
Code:
http://wrs.search.yahoo.co.jp/*


Maybe All links on search results page goes to
Code:
http://wrs.search.yahoo.co.jp/*http://example.com
at first and then redirected to
Code:
http://example.com





In addition,
http://wrs.search.yahoo.co.jp/*http(s)://example.com
http://rd.search.yahoo.co.jp/*http(s)://example.com
http://ord.search.yahoo.co.jp/*http(s)://example.com
are used in http://*.yahoo.co.jp/* and all of them are to be replaced. I'd appreciate your making filter(s) for them if possible.
 

avatar

Administrator
Staff member
Administrator
The task is pretty complicated, I'll think about it a bit later.

Again, I'd prefer to use JS rules instead of replace.
 

seanl

Well-Known Member
Hi, I think the way they do it is indeed straightforward, I've seen another search portals using similar technique.

If you open the browser console and inspect the links of search results, you will see something like this:
Code:
<a onmousedown="return lswap(this,'https%3A//developer.android.com/about/dashboards/index.html%3Fhl=ja','FOR=.dksh2FV3iiHec8iuP1kiZXFVOTFI8qVYp8ixJEoI2Zn5NvpKaeppDfNg_qEpfKW8HoC3urXj1fNtgsxpQPIXH47HM_R7o9eimdN8TUNnvhNoXrRon5jKamw5upMd7cofX9UID8vL77nOdubUOYNuE_AB4C987mYBoMYGvf6DOx16jA3N555NXbd8hm40DjdGHMEzhZLB5tgfldataMqxACb3Uf07N0_qSuvjerja1zV0rsbxoUKBpvt8XYrZIOPHlm.oA--/','A2RCKRvgwW1YEBQA8wKDTwx.','X3oDMTEyOGNmMGZsBHBvcwMxBHNlYwNzcgRzbGsDdGl0bGUEdnRpZANqcDAwMjM-','12lo95eqr','1483688864')" href="https://developer.android.com/about/dashboards/index.html?hl=ja">ダッシュボード | <b>Android</b> Developers</a>
So the href attribute contains the actual url, but they do something when you click on the link. As the name 'lswap' suggests, it 'swaps' the href attribute of the link to search.yahoo.co.jp/r/.... urls.
The method lswap is defined in a way that we can wrap it, so
Code:
search.yahoo.co.jp#%#Object.defineProperty(window, 'lswap', { get: function() { return function() { return true; } } });
would work. This is not a safe unless tested on many different pages in yahoo.co.jp, because different page may implement different 'lswap's.
On my end the above rule works for both desktop pages and mobile pages. I don't experience redirects to wrs.search.yahoo.co.jp, only search.yahoo.co.jp/r/, like this one:
Code:
http://search.yahoo.co.jp/r/FOR=jAWNgk5V3ijEFfRM5zXk8sL01K3WE_X4CernmoquOkHuWTJXSkRwM4gT860tsyihqUgIK_xokZb9R7h9UXOWWO4f4iUU70GnHNlxbrANfauB1Z7tMrci1x0pvVaY1WIu2SIWibkYRkkrXnROkgwDJ9ZTc_8Yie1F5o59AXkghii63M1DC_nm03VjEsWEzQ..FiBJm4jcSH0Aj0e0OxBJLTfu_14-/_ylt=A7YWNLgnxW1YLg4AAQSDTwx.;_ylu=X3oDMTEyZzUxdjF0BHBvcwMyBHNlYwNzcgRzbGsDdGl0bGUEdnRpZANqcDAwMjM-/SIG=11nhfk2de/EXP=1483689703/**https%3A//www.android.com/intl/ja_jp/
so maybe something is different on my end. You can try the above rule and report back if there is a page on which the redirect was not removed.
 

Blaz

Moderator & Translator
Staff member
Moderator
Or just remove the element onmousedown of every a with javascript.
 
Top