【问题标题】:Get a list of YouTube Music library uploads [closed]获取 YouTube 音乐库上传列表 [关闭]
【发布时间】:2020-08-23 10:30:48
【问题描述】:

我需要获取我的 YouTube Music 上传库中所有专辑的列表。如何管理?

【问题讨论】:

  • 您是否尝试过使用 google 提供的标准 http rest API?
  • @JRichardsz 你能分享链接吗?我没有找到 YouTube 音乐库上传。谢谢

标签: web-scraping youtube youtube-api


【解决方案1】:

据此2018/2019:https://support.google.com/youtubemusic/thread/191756?hl=en

YouTube 音乐仅在几周前推出。目前,没有可用的 YouTube Music 特定 API,但如果 YouTube 决定发布一个,您可能会在 Google Developers 页面上找到它。

正如您和其他人所说,我认为没有可用的rest api。请注意,它可能是测试版产品,随时可能被弃用。

无论如何,如果youtube音乐库没有发布一个api,不管是否愿意,一定是在使用一种api在其网页中显示信息。

如果我们检查它的主页https://music.youtube.com/tasteprofile,我们可以看到几个ajax 请求。其中之一是:

https://music.youtube.com/youtubei/v1/music/get_search_suggestions?alt=json&key=AI***YFDNX30

有了这个请求头

Host: music.youtube.com
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
Content-Length: 1125
X-Goog-Visitor-Id: Cgs**D
X-Goog-AuthUser: 0
X-Goog-PageId: null
x-origin: https://music.youtube.com
X-YouTube-Client-Name: 67
X-YouTube-Client-Version: 0.1
X-Youtube-Identity-Token: QUFFLUh***lRDR5Z3w=
Origin: https://music.youtube.com
Authorization: SAPISIDHASH 159***efb5c
Referer: https://music.youtube.com/tasteprofile

我们可以在其中看到 X-Youtube-Identity-Token。因此,如果您找到了获取此令牌的方法,您可以使用 music.youtube.com 中使用的一些端点。

这里有一些资源,您可以在其中了解如何使用 X-Youtube-Identity-Token 来获取:YouTube 自动播放推荐视频。所以我认为,Youtube Api 被使用:

【讨论】:

    【解决方案2】:

    请随意使用 ytmusicapi,它有你需要的一切。

    https://github.com/sigma67/ytmusicapi

    https://ytmusicapi.readthedocs.io/

    完全披露:我是作者。

    作为参考,您可以使用get_library_upload_albums获取上传专辑的完整列表。

    获取用户库中已上传歌曲的专辑。 参数:

    limit – Number of albums to return. Default: 25
    order – Order of albums to return. Allowed values: ‘a_to_z’, ‘z_to_a’, ‘recently_added’. Default: Default order.
    

    返回:

    get_library_albums() 返回的专辑列表

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-11
      • 1970-01-01
      • 2017-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多