Benjamin-Loison / YouTube-operational-API

YouTube operational API works when YouTube Data API v3 fails.
397 stars 49 forks source link

Automate from a Google account generate a YouTube Data API v3 key to ease empowering the no-key service #238

Open Benjamin-Loison opened 8 months ago

Benjamin-Loison commented 8 months ago

The Stack Overflow answer 74579030 could help.

This way I will verify and ease each of my Google account. Well I checked all of them in my KeePassXC and all except one were having projects, hence very probably using YouTube Data API v3 for this purpose.

import undetected_chromedriver as uc
from selenium.webdriver.common.by import By

driver = uc.Chrome()

driver.get('https://console.cloud.google.com/projectcreate')
driver.find_element(By.XPATH, '//span[text()="Créer"]').click()
driver.get('https://console.cloud.google.com/marketplace/product/google/youtube.googleapis.com')
# Full XPath worked.
#driver.find_element(By.XPATH, '//span[text()=" Activer "]').click()
driver.find_element(By.XPATH, '//span[text()="Créer des identifiants"]').click()
driver.find_element(By.XPATH, '//input[@value="API_KEY"]').click()
driver.find_element(By.XPATH, '//span[text()=" Suivant "]').click()

#driver.find_element(By.XPATH, '//input[starts-with(@value,"AIzaSy")]')
print(driver.find_element(By.XPATH, '//*[@id="_1rif_mat-input-0"]').get_attribute('value'))

driver.close()

Related to #237.

Benjamin-Loison commented 8 months ago

Cannot delete and create project on the fly to have unlimited quota? Furthermore if it works it would not be detect as Google detects multiple projects for multiple quotas.