【问题标题】:how do i get the last watched video in my youtube history with python?如何使用 python 获取我的 youtube 历史中最后观看的视频?
【发布时间】:2020-09-27 19:50:26
【问题描述】:

我想制作一个 python 脚本来获取我在我的帐户上观看的最后一个视频的链接

据我发现人们说 YouTube API3 停止使用观看历史播放列表,所以我一直在尝试让 beutifulsoup 抓取观看历史,它只抓取 youtube.com 而不是 youtube.com/feed /history 当我运行我的脚本时。

import requests
from bs4 import BeautifulSoup

with requests.Session() as s:

    p = s.post("https://www.youtube.com/feed/history", data={
        "email": 'username',
        "password": "pass"
    })
    print(p.text)

    base_page = s.get('https://www.youtube.com/feed/history')
    soup = BeautifulSoup(base_page.content, 'html.parser')
    print(soup.title)

【问题讨论】:

    标签: python youtube


    【解决方案1】:

    去看看https://developers.google.com/youtube/1.0/developers_guide_python 这会告诉您有关通过 python 访问 youtube 所需了解的所有信息

    【讨论】:

    • 正如我所说,YoutubeAPI 停止使用观看历史记录,如果您尝试获取观看历史记录,即使您给它一个 API_KEY 和所有内容,它也不会返回任何内容
    • 我可能错了,但这就是question 的答案
    猜你喜欢
    • 1970-01-01
    • 2022-08-05
    • 2015-08-31
    • 2013-09-04
    • 2019-04-14
    • 2011-03-20
    • 2018-09-02
    • 2023-03-17
    • 2015-08-30
    相关资源
    最近更新 更多