gpt4 book ai didi

javascript - YouTube API - 抓取视频上传日期

转载 作者:行者123 更新时间:2023-11-30 19:57:24 25 4
gpt4 key购买 nike

我不仅要抓取 YouTube 的发布日期,还要抓取视频的上传日期。我的公司在视频公开发布前几天或几周将视频作为私有(private)列表上传。查询 part=snippet 将返回“publishedAt”项,这是视频公开发布的时间。但我没有看到类似的“uploadedAt”项目。当我转到 YouTube 上的视频编辑页面时,我可以看到上传日期(目前我正在手动将其复制到我的电子表格中),但它似乎无法在 YouTube APIv3 中访问。

我是不是遗漏了什么,或者我假设没有办法抓取视频的上传日期是否正确?

最佳答案

不幸的是,一旦私有(private)视频更新为公开,publishedAt 日期将从视频上传之日更新为公开之日。此时,上传日期不再直接在 API 中可用。

来自 YouTube 关于 snippet.publishedAt 的文档:

The date and time that the video was published. Note that this time might be different than the time that the video was uploaded. For example, if a video is uploaded as a private video and then made public at a later time, this property will specify the time that the video was made public.

There are a couple of special cases:

  • If a video is uploaded as a private video and the video metadata is retrieved by the channel owner, then the property value specifies the date and time that the video was uploaded.
  • If a video is uploaded as an unlisted video, the property value also specifies the date and time that the video was uploaded. In this case, anyone who knows the video's unique video ID can retrieve the video metadata.

The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.

Relevant documentation about this behavior can be found here

作为替代方案,您可以考虑使用基于浏览器的工具(例如 Selenium)抓取 YouTube Studio 信息中心(或使用 BeautifulSoup 之类的工具来解析信息中心 HTML)以获取您要查找的数据。

关于javascript - YouTube API - 抓取视频上传日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53814129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com