如何使用 selenium chrome 驱动程序将视频上传到 YouTube?
How can I upload videos to YouTube using selenium chrome driver?
我根本不想使用 YouTube API,因为我发现它非常有限。有没有一种方法可以使用 Selenium 将我的视频上传到 Python 中的 YouTube?我 运行 遇到的问题是 Google 不允许我登录。有什么方法可以在不使用 YouTube API 的情况下将视频上传到 YouTube?
这是我的代码:
blist = []
b1 = webdriver.Chrome("chromedriver")
email = "email@gmail.com"
blist.append(b1)
for browser in blist:
browser.implicitly_wait(5)
browser.get("https://accounts.google.com/signin")
loginBox = browser.find_element_by_xpath('//*[@id="identifierId"]')
loginBox.send_keys(email)
nextButton = browser.find_elements_by_xpath('//*[@id ="identifierNext"]')
nextButton[0].click()
您必须更改您的用户代理才能登录 Google,试试这个:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
path = path
useragent = "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18"
options_ = Options()
options_.add_argument('user-agent='+useragent)
driver = webdriver.Firefox(options=opts ,executable_path=PATH)
driver.get('https://youtube.com')
试一试 ytb_up 基于硒
https://github.com/wanghaisheng/ytb-up
您可能需要的功能
- 代理支持
自动检测是否需要代理
2. cookie 支持
对于同一 google 帐户下的多个频道
3. 预定时间发布
您可以为每个视频明确指定日期和时间,或者您可以设置发布策略和每日 public 计数,例如,每日计数为 4,您有 5 个视频,则前 4 个将被发布上传日期后 1 天,其他 1 将是上传日期后 2 天
4.修复google账户验证
我根本不想使用 YouTube API,因为我发现它非常有限。有没有一种方法可以使用 Selenium 将我的视频上传到 Python 中的 YouTube?我 运行 遇到的问题是 Google 不允许我登录。有什么方法可以在不使用 YouTube API 的情况下将视频上传到 YouTube?
这是我的代码:
blist = []
b1 = webdriver.Chrome("chromedriver")
email = "email@gmail.com"
blist.append(b1)
for browser in blist:
browser.implicitly_wait(5)
browser.get("https://accounts.google.com/signin")
loginBox = browser.find_element_by_xpath('//*[@id="identifierId"]')
loginBox.send_keys(email)
nextButton = browser.find_elements_by_xpath('//*[@id ="identifierNext"]')
nextButton[0].click()
您必须更改您的用户代理才能登录 Google,试试这个:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
path = path
useragent = "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18"
options_ = Options()
options_.add_argument('user-agent='+useragent)
driver = webdriver.Firefox(options=opts ,executable_path=PATH)
driver.get('https://youtube.com')
试一试 ytb_up 基于硒
https://github.com/wanghaisheng/ytb-up 您可能需要的功能
- 代理支持
自动检测是否需要代理 2. cookie 支持
对于同一 google 帐户下的多个频道 3. 预定时间发布
您可以为每个视频明确指定日期和时间,或者您可以设置发布策略和每日 public 计数,例如,每日计数为 4,您有 5 个视频,则前 4 个将被发布上传日期后 1 天,其他 1 将是上传日期后 2 天 4.修复google账户验证