Reverse Image Lookup on Google with Python programming tutorial

preview_player
Показать описание
In this programming tutorial, I cover how you can do a reverse image lookup with Google. This can be used for image source detection, image content detection, or even image recognition.

I personally used this script for image recognition, to determine the content of the image, but you could also use this to detect inappropriate images on your websites.

User-agent:

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

Posted the user-agent line in the description, but here it is as well: opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17')]

sentdex
Автор

To anyone still trying to get this to work: Don't. Google changed how they use Google image search so it is a bit more difficult.

theautonomous
Автор

Make your life a lot easier. Parse the output with BeautifulSoup!

therochdaleherald
Автор

Notice that "images.google.com" instead of "google.com" which was mentioned at the time, when @sentdex produced this video.

Regex needs some correction. But atleast you don't get the "404" error.

realyogi
Автор

whoa very important to use the corresponding user agent as to the browser you use when catering the findLinks statement
found this worked for Chrome
user agent -> 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13'

 findLinks=re.findall(r'<div class="rg_meta">{"os":".*?", "ou":"(.*?)"', sourceCode)

horlacsd
Автор

I cant see the websites that is produced once you ran this code anymore using this example, do you happen to know why?

zohan
Автор

I noticed something about python and regexes. If the document you search get's too long (and i haven't determined the size yet but i had it happen on documents with merely a few kilobytes) a simple

re.findall(regex, string)

just stops to find matches. It does a bunch, but then stops in the middle of the document. That holds especially true the more complex the regex is, though easy regexes are still prone to it.

The only reliable option i found was to actually compile the regex into a regex object before you use it (if the same regex is used often, just put it into a global scope).

So i had to do

regex = re.compile(regex)

and later in the code i used it with

regex.findall(string)

That method has yet to fail me. I just mention it, since some google responses can be massive, and if you really want to catch all matches it's better to be sure.

mulchi
Автор

Does the google path still works? It is showing 404 error

GopeshDwivedi
Автор

Are you sure this works nowadays? it gets me 404 and returns nothing

linux
Автор

Is it legal to query google like this ?

siddhartha
Автор

I'm looking for suggestions on how to automatically reverse image search to find the highest resolution image available (a bot for Reddit). I just learned how to use the praw API, but I don't know how to do the reverse image search portion and find the largest dimensions. Any ideas?

pepsico
Автор

awesome tutorial... did a reverse lookup of a cockshot and all i got were anteater gifs tho

horlacsd
Автор

Can you make a video showing how to record somebody's voice and computer sound?

AncientEntity
Автор

Snowden if you read this could you please do us a favor and make a 2020 update for this video? This seems to be pretty old

erfantaghvaei
Автор

now you just need a captcha solver for when your program is banned... fun idea though

foo_tube