1

I'm trying to get the e-mail of Youtube Channel. This is an example link. As you can see, to see the e-mail you have to LOGIN and then bypass RECAPTCHA. Honestly saying, I'm stuck at the first stage. Google doesn't think the selenium browser isn't safe to login and blocks it. The reason (I'm guessing) is because it thinks I'm an automized browser. So basically I have to let it think it's not a bot. I tried randomizing user-agent, and turning off the auto extension by code, but it still blocks my scraper. I have also checked if the selenium browser has "turned-off" the javascript since Google told me to check if it is.

So, I'm guessing there is a way to scrape using Scrapy or requests? Or I haven't tried enough with Selenium? I've seen an useful video that scrapes subtitles from Youtube without loggin by TechLead. So it seems it's not impossible. I'm still working on it, so if anyone has an answer or advice please let me know, thank you for reading.

Refence

Google login block Selenium Google Login Block

Randomizing User Agent Way to change Google Chrome user agent in Selenium?

Websites detecting Selenium Automation How to make Selenium script undetectable using GeckoDriver and Firefox through Python?

Jay
  • 23
  • 7

1 Answers1

4

Try this code, for bypassing Gmail login. Use Seleniumwire with undetected browser v2

Note: put chromedriver in your sys path.

from seleniumwire.undetected_chromedriver.v2 import Chrome, ChromeOptions
import time

options = {}
chrome_options = ChromeOptions()
chrome_options.add_argument('--user-data-dir=hash')
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--disable-dev-shm-usage")
# chrome_options.add_argument("--headless")
browser = Chrome(seleniumwire_options=options, options=chrome_options)

browser.get('https://gmail.com')
browser.find_element_by_xpath('//*[@id="identifierId"]').send_keys('your-email')
browser.find_element_by_xpath('//*[@id="identifierNext"]/div/button').click()
time.sleep(5)
browser.find_element_by_xpath('//*[@id="password"]/div[1]/div/div[1]/input').send_keys('you-password')
browser.find_element_by_xpath('//*[@id="passwordNext"]/div/button').click()

In addition to this, selenium wire has many awesome features, check out Github repository

Anandesh Sharma
  • 436
  • 6
  • 22