Request: Remove Wikipedia Results From Yahoo Search Results

Subscribe to Request:  Remove Wikipedia Results From Yahoo Search Results 13 posts, 4 voices

 
anonymous_user User

I'm sick of having Wikipedia's propaganda appear as the first link on every result from Yahoo.

Can someone write a script please to remove the wikipedia results?

Pretty please?

P.s. Excuse the crude username. I had to borrow an account from bugmenot after not receiving an activation email subsequent to my registration.

 
znerp Scriptwright

This'll do it; of course, it'd mean you'll be down a result or two on any pages that have wikipedia links in them...

var allWiki = document.evaluate('//div[@id="main"]/div[@id="web"]/ol/li/div[@class="res"]/span[@class="url"]/b[. = "en.wikipedia.org"]',
                                document,
                                null,
                                XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
                                null);
for (i = allWiki.snapshotLength - 1; i >= 0; i--)
  (resItem = allWiki.snapshotItem(i).parentNode.parentNode).parentNode.removeChild(resItem);

 
dob Scriptwright

What exactly does /b[. = "en.wikipedia.org"] look for?

 
znerp Scriptwright

If you perform a search on yahoo.com (eg. a search for greasemonkey), notice how the url at the bottom of each result (in green) has the host in bold. What /b[. = "en.wikipedia.org"] matches is a bold tag with textcontent equal to "en.wikipedia.org". I believe I could have used /b[text() = "en.wikipedia.org"] instead.

 
anonymous_user User

znerp,

Thanks, much obliged. I'm gonna give it a go.

Surely specifying "search.yahoo.com" as the included page will prevent it from removing the links from any other page, so what do you mean?

P.s. Can I paypal you some moola?

 
anonymous_user User

EXCELLENT WORK!!!

I must send you $20.

Please, what is your paypal?

 
znerp Scriptwright

Surely specifying "search.yahoo.com" as the included page will prevent it from removing the links from any other page, so what do you mean?
Yeah, I'd go with http://search.yahoo.com/search* or similar for the includes.

Please, what is your paypal?
You really don't need to send me anything for this; I don't do this for any money, and I'm pretty sure no one else on these forums does either.

 
teukkam Scriptwright

You really don't need to send me anything for this; I don't do this for any money, and I'm pretty sure no one else on these forums does either.

Apparently, someone does:
http://userscripts.org/scripts/show/7917

 
znerp Scriptwright

Yeah, I've got a few paypal links on some of my script pages. I started removing them and apparently got distracted along the way. My point was though that it would be somewhat misdirected to aim to get some money through posting on these forums. There are a lot of active posters, some of whom put a lot more effort into writing replies to topics than I do, so I don't think it would be fair for me to take someone's money.

 
dob Scriptwright

znerp wrote:

If you perform a search on yahoo.com (eg. a search for greasemonkey), notice how the url at the bottom of each result (in green) has the host in bold. What /b[. = "en.wikipedia.org"] matches is a bold tag with textcontent equal to "en.wikipedia.org". I believe I could have used /b[text() = "en.wikipedia.org"] instead.

Ok, thanks. So . seems equal to text()? How would I match href attributes, or src attributes? And actually use a regular expression?
 
znerp Scriptwright

So . seems equal to text()?
I don't know much about XPath, but see here for details on what the dot refers to.

How would I match href attributes, or src attributes?
You can see also in the link I posted about these, eg. //a[@src="foo.jpg"].

And actually use a regular expression?
I don't know about this; this is why I've not replied to the topic you created. Try googling it?

 
dob Scriptwright

I did, couldn't really find anything but this.
That's why I opened the topic :D

 
anonymous_user User

Znerp,

I hate to bug you,

But Yahoo seems to have changed something, and your script no longer works.

Can you please help me?

Thanks