1

Soo.. I tried creating a Python script that logs into YouTube and then searches up a term I often use. See below -->

from selenium import webdriver
import time
driver = webdriver.Chrome()
url = 'https://www.youtube.com'
driver.get(url)
driver.maximize_window()
time.sleep(3)
button = driver.find_element('xpath', "//a[@aria-label='Sign in']//div[@class='yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response-inverse']//div[@class='yt-spec-touch-feedback-shape__fill']")
button.click()
Username = driver.find_element('xpath', "//input[@id='identifierId']")
Username.send_keys('EMAIL')
driver.implicitly_wait(3)
Next = driver.find_element('xpath', "//span[normalize-space()='Next']")
Next.click()
time.sleep(3)
driver.implicitly_wait(3)
Password = driver.find_element('xpath', "//input[@name='Passwd']")
Password.send_keys('PASSWORD')
time.sleep(3)
driver.quit()

But as everything was at its best, it hits me with THIS:

https://i.imgur.com/claJCND.png

And I have seen similar posts like this one. But this doesn't cover the use of actually typing in the keys as usual. Instead it goes into detail about how you might solve this issue using Cookies and thus by the use of gmail.

Any thoughts on how you could go around this?

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
  • Also consider using [YouTube Data API v3](https://developers.google.com/youtube/v3) [Search: list](https://developers.google.com/youtube/v3/docs/search/list) endpoint. – Benjamin Loison Jul 29 '23 at 20:12

0 Answers0