I would like to get source code from a google image search, I saw in Google Search by Image Script for Local Images that https://www.google.com/searchbyimage?&image_url=
+ image link
works. I am using Python and this is what I tried:
from bs4 import BeautifulSoup
import requests
browser = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
headers={'User-Agent':browser,}
url = ("https://www.google.com/searchbyimage?&image_url="+"http://mlm-s1-p.mlstatic.com/635657-MLM25528207389_042017-O.jpg")
page = requests.get(url, headers= headers)
soup = BeautifulSoup(page.text, "html.parser")
pretty = soup.prettify()
print(pretty)
Which is pretty different from Chrome's source code if we add view-source:
to this.
If you want to know, the purpose of the script is to find Google's best guess of the image as a string, in my example it would be: lemmy kilmister funko pop
, but I can't even find any of this words in Beautiful Soup's html.
EDIT: Forgot to include libraries and beautifulsoup/ requests