89

I often search documents (mainly PDFs) using Google. But when I right click the link, or just hang the mouse cursor over it. What I get is NOT the real link, but some thing long and confusing like the following:

http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCUQFjAA&url=http%3A%2F%2Fwww.marxists.org%2Freference%2Farchive%2Feinstein%2Fworks%2F1910s%2Frelative%2Frelativity.pdf&ei=Fai1TZq-Acugtgenw6DqDg&usg=AFQjCNFzYOTqpf68rQnuwW9K7wp39WL6Rg&sig2=z4RqvOLEEJsPohBqr1ghxQ

I have no idea what this is but I know this nonsense is not what I want, I want the real link (for the one above: http://www.marxists.org/reference/archive/einstein/works/1910s/relative/relativity.pdf), not something with Google's intervention.

How do I get the “Real” link to file in Google search results?

jww
  • 97,681
  • 90
  • 411
  • 885
mayasky
  • 1,025
  • 1
  • 9
  • 9
  • Google does some magic when you click the link: `onmousedown="return clk(this.href,'','','','1','','0CCMQFjAA')"` – Blender Apr 25 '11 at 17:10
  • Just go with Blender's solution, or you could end up wasting time for no good reason. – Null Head Mar 20 '12 at 03:11
  • 6
    This question appears to be off-topic because it is not about programming. Perhaps [Web Apps Stack Exchange](http://webapps.stackexchange.com/) would be a better place to ask. (Great question, btw. I did not like casting the close vote. And it irritates me, too). – jww Jun 23 '14 at 17:58
  • Solutions for several browsers (using addons or plugins) can also be found and are summarized here: http://www.makeuseof.com/tag/copy-crapfree-urls-googles-search-results/ – Abel Sep 03 '15 at 11:33
  • 1
    I use this Chrome extension: https://chrome.google.com/webstore/detail/dont-track-me-google/gdbofhhdmcladcmmfjolgndfkpobecpg – Venryx Apr 27 '17 at 02:01

10 Answers10

55

Maybe this is not the best solution, but here's one way that doesn't require coding or add-ons for Chrome and Firefox. Assume there are similar ways to do this for IE and others, though at least IE will usually open PDFs in the browser with the link in the url bar at the top which is easy enough to copy.

  1. Click on the search result, which should download the PDF.

  2. Now in your browser open the list of recent downloads

  • Chrome, Ctrl+J
  • Firefox on Linux(?), it's Ctrl+Shift+Y
  1. Now copy the link
  • Chrome: Right click on the URL listed beneath the name of the file and select "Copy Link Address"
  • Firefox: Right click on the file and select "Copy Download Link"

EDIT: As of December 2020, and probably earlier, Chrome shows you a clean, copyable URL in the search results.

dlm
  • 4,054
  • 2
  • 23
  • 19
  • +1 This is actually the best solution for 95% of my use cases, where I will want to send the document URL to someone else after having read it myself. – Michael Hoffman Nov 29 '12 at 01:17
31

I've created a simple web site that cleans Google search result URLs:

URL Clean

URLs copied from Google search results (such as links to PDFs) are more complicated than they need to be. This tool removes the unnecessary parts, leaving the page's original URL.

Community
  • 1
  • 1
James Trimble
  • 1,868
  • 13
  • 20
18

From a comment in @Blender answer, I've learned how to install a User Script in Firefox and Chrome.

Now, when right clicking and copying a URL in Google search results, I get the real link instead of that rubbish (sorry, Google, I know you love us, but we don't need no stinky tracking URLs).

At first, I used googlePrivacy as suggested by @naxa, but it's bugging nowadays. The script provided in Web Applicatations SE, Turning off Google search results indirection, does the work. It has User Script and Extension flavors:

Bellow the info on how to proceed with the User Script.

Installing the UserScript

In Chrome, I installed it using Tampermonkey.

tampermonkey

And Greasemonkey in Firefox.

greasemonkey

Results

Before the UserScript

ugly google

After

cool google


Related post in Web Applications:

Community
  • 1
  • 1
brasofilo
  • 25,496
  • 15
  • 91
  • 179
  • 2
    "Don't track me Google" at the Chrome Web Store installed right away without needing TamperMonkey, excellent. So now for all the other browsers on my PC :) This worked for the nice Opera browser: https://addons.opera.com/en/extensions/details/remove-google-redirects/ I was looking for a solution for all search result links, not for download links only, since the redirect certainly delays your browsers somewhat and sometimes hangs completely :/ – Henrik Erlandsson May 12 '14 at 17:15
10

The URL is right here:

&url=http%3A%2F%2Fwww.marxists.org%2Freference%2Farchive%2Feinstein%2Fworks%2F1910s%2Frelative%2Frelativity.pdf

Just unescape it with some language, like Python:

>>> import urllib
>>> print urllib.unquote('http%3A%2F%2Fwww.marxists.org%2Freference%2Farchive%2Feinstein%2Fworks%2F1910s%2Frelative%2Frelativity.pdf')
http://www.marxists.org/reference/archive/einstein/works/1910s/relative/relativity.pdf

So to extract the URL from a Google url, here's a script to do so:

import urllib

url = raw_input('What is the Google url? ')
url = url[url.find('&url=') + 5:]
url = url[:url.find('&')]

print urllib.unquote(url)
Blender
  • 289,723
  • 53
  • 439
  • 496
  • Thanks, but I want to stay within my browser...The 'real' url is not for programming purpose, just to be copied and pasted as some information of the pdf file I download. – mayasky Apr 25 '11 at 22:51
  • 1
    You could make this into a userscript... – Blender Apr 26 '11 at 18:55
  • People already did, one for example: http://userscripts.org/scripts/show/29078 mayasky, btw., if you not intend to write an userscript, you could ask this question on Superuser.com that is for power users, instead of stackoverflow.com that is for programers. For other google related userscripts of interest see http://userscripts.org/tags/google?sort=rating – n611x007 Oct 29 '12 at 07:09
  • @naxa, thanks a bunch for the hint! I compiled [an Answer](http://stackoverflow.com/a/14176138/1287812) here in this thread ;) – brasofilo Jan 05 '13 at 20:46
7

I'm using a Firefox extension named Google/Yandex search link fix, it works just great and allows direct copy of the link target

Open SEO
  • 1,682
  • 14
  • 16
3

Doing a little google searching and ran across the Firefox add-on called LinkWalker.

Simple context menu utility for links which decodes embedded and cloaked URLs, strips off query-string parameters and converts text selections to clickable link.

Sounds like that could do the trick.

Marko
  • 20,385
  • 13
  • 48
  • 64
2

it a long link because Google wants to keep track of who found what, and actually clicked on a search result...

if you want the real link (the above is also a real link!)

type this on your linkx-prompt:

php -r "print urldecode('http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCUQFjAA&url=http%3A%2F%2Fwww.marxists.org%2Freference%2Farchive%2Feinstein%2Fworks%2F1910s%2Frelative%2Frelativity.pdf&ei=Fai1TZq-Acugtgenw6DqDg&usg=AFQjCNFzYOTqpf68rQnuwW9K7wp39WL6Rg&sig2=z4RqvOLEEJsPohBqr1ghxQ');" | awk -F'&' '/url=/{ print $5 }'
Luuk
  • 12,245
  • 5
  • 22
  • 33
1

When I look up this search in Internet Explorer I do indeed get this link

But when I use Chrome, I get what you want. So it seems to be an IE feature, or at least have something to do with the browser you are using. If you are in the position to change browsers, I would consider using chrome (tested, gives normal URL) or opera (tested, normal url) but not firefox (tested, gives funky url)

Nanne
  • 64,065
  • 16
  • 119
  • 163
  • Have to stay with Firefox because I want to use Zotero (an excellent citation manager) which sadly exists as a FireFox addon. I also use Chrome a lot, but my Chrome gives the same long useless url. It seems whether google.com or google.cn also makes a difference on the url you get. I am wondering what's going on behind the scene, anyway, I have to stay with some detour for now. – mayasky Apr 25 '11 at 22:50
  • Chrome doesn't work for me either. – Brian Neal Jan 21 '12 at 01:26
  • It's not an IE feature. It's present in IE, FF, Opera, and - Chrome. I don't recall seeing it in Safari on Mac, but I can check when I get back to work. – Henrik Erlandsson May 12 '14 at 16:58
0

See this tool

http://www.duvidasdeinformatica.com/blog/limpar-links-paginas-resultados-google/

It's in portuguese, but at the bottom you have a box where you can copy/paste the url, and it get's "converted" to the real one...

foxtrot
  • 1,056
  • 1
  • 8
  • 24
-3

I think I read once, while having the same frustration, that it masks the actual URLs ONLY when you're logged into your google account and your accounts settings are configured for web history tracking.

IF my memory serves me correctly, you could try: - performing the search in a separate browser window using your browsers native "private" or "incognito" browsing feature - simply log out of your google account, get your results and log back in - go to google.com/history and click "Pause", which prevents future web activity from being saved, and then return to the same page after grabbing your results and click "Resume" (if you intend to use Web History).

If this sort of activity is something where you would routinely want to grab multiple URLs from the results and the above technique doesn't work as I recall, you can try something like an add-on to firefox, such as Copy Link URL, which provides the ability to copy the URLs of links you select which you could then paste into a text editor and replace the encoded elements with a Find & Replace.

Or, you could perhaps do a little research to find a website that will decode the URL for you. I found URL Deobfuscator on webtoolhub.com that does a good job of making the main / desired URL available for copy/paste by decoding the encoded characters, removing query strings, etc.

Cheers.