As a Challenge to my self I'm trying to scrape translations from google translate. I download the html file by a browser simulated request and then using beautifulSoupe 4 I try finding the translation in the html code. The problem is that although I can find what I want in Chrome WebDev Mode I cant do such thing in Python or using another program such as noteblock. Here is my code:
while Translating==True:
text=input(("Values to translate:"))
#CREATING URL TO SCRAPE
translator_url_with_translation_embebed= translator_url+ EncodeTexttoURL(text)
#REQUESTING PAGE WITH FAKE HEADERS (avoiding no browser detection)
url = translator_url_with_translation_embebed
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response= requests.get(url, headers=headers)
print(response.content)
#ANALISING RESPONSE FOR FURTHER USE
sopa = BeautifulSoup(response.content)
translation_location=sopa.find_all('span', {'class' : 'tlid-translation translation'})
print("TRANSLATED LOCATIOON")
print(translation_location
` translation_location outputs an empty list.
Browser Dev mode showing translation in html code:
How can i find them? Are the translations elsewhere? Did google sent a modified version of their website to fool me?!
Thanks for the help
