jjzjj

javascript - 跟踪 YouTube 观看历史

coder 2024-07-28 原文

为了自动跟踪我的时间,我想获取我的观看历史记录(最好的情况:一天一次,最坏的情况是一分钟一次),并将其添加为 Google 日历事件。

虽然我设法添加了 Google 日历事件,但无法获取我的 YouTube 观看历史记录。

所以我想知道 v3 API 是否提供类似的东西,或者是否有某种创建播放列表的技巧?

最佳答案

不幸的是,YouTube API 团队似乎已停止使用此功能。

2016 年 8 月 11 日,they announced that they would be deprecating the APIs for watch later and watch history playlists :

The channel resource's contentDetails.relatedPlaylists.watchHistory and contentDetails.relatedPlaylists.watchLater properties are only visible to an authorized user retrieving data about the user's own channel. After September 12, 2016, the contentDetails.relatedPlaylists.watchHistory will return a value of HL and the contentDetails.relatedPlaylists.watchLater property will return a value of WL for all channels.

Requests to retrieve playlist details (playlists.list) for a channel's watch history or watch later playlist will return an empty list after September 12, 2016. Requests to retrieve playlist items (playlistItems.list) in either of those playlists will also return an empty list after that time. This is true for the new values, HL and WL, as well as for any watch history or watch later playlist IDs that your API Client may have already stored.

2016 年 9 月 15 日,they announced they had removed this information from the APIs : (强调我的)

The channel resource's contentDetails.relatedPlaylists.watchHistory and contentDetails.relatedPlaylists.watchLater properties now contain values of HL and WL, respectively, for all channels.

To be clear, these properties are only visible to an authorized user retrieving data about the user's own channel. The properties always contain the values HL and WL, even for an authorized user retrieving data about the user's own channel. Thus, the watch history and watch later playlist IDs cannot be retrieved via the API.

In addition, requests to retrieve playlist details (playlists.list) or playlist items (playlistItems.list) for a channel's watch history or watch later playlist now return empty lists. This behavior is true for the new values, HL and WL, as well as for any watch history or watch later playlist IDs that your API Client may have already stored.

2016 年 11 月 2 日,他们甚至 announced new errors indicating that such contents cannot be retrieved from the API :

The playlistItems.list method returns this error to indicate that the request tried to retrieve "watch history" playlist items, but those cannot be retrieved using the API.

另一方面,有像 overview page 这样的文档和 migration from v2 guide仍然表示通过播放列表 API 获取 ID 的旧方法。我个人认为这些文档已经过时了。

如果我处于您的位置,我会围绕它解决我的要求,避免这种情况。您可以返回到 v2 或做一些其他事情,例如抓取网站,但如果 YouTube API 明确阻止这些内容提供给第三方,您可能会遇到法律问题。

关于javascript - 跟踪 YouTube 观看历史,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46987690/

有关javascript - 跟踪 YouTube 观看历史的更多相关文章

  1. ruby-on-rails - 使用 javascript 更改数据方法不会更改 ajax 调用用户的什么方法? - 2

    我遇到了一个非常奇怪的问题,我很难解决。在我看来,我有一个与data-remote="true"和data-method="delete"的链接。当我单击该链接时,我可以看到对我的Rails服务器的DELETE请求。返回的JS代码会更改此链接的属性,其中包括href和data-method。再次单击此链接后,我的服务器收到了对新href的请求,但使用的是旧的data-method,即使我已将其从DELETE到POST(它仍然发送一个DELETE请求)。但是,如果我刷新页面,HTML与"new"HTML相同(随返回的JS发生变化),但它实际上发送了正确的请求类型。这就是这个问题令我困惑的

  2. ruby - 如何更改此正则表达式以从未指定 v 参数的 Youtube URL 获取 Youtube 视频 ID? - 2

    目前我正在使用这个正则表达式从YoutubeURL中提取视频ID:url.match(/v=([^&]*)/)[1]我怎样才能改变它,以便它也可以从这个没有v参数的YoutubeURL获取视频ID:http://www.youtube.com/user/SHAYTARDS#p/u/9/Xc81AajGUMU感谢阅读。编辑:我正在使用ruby​​1.8.7 最佳答案 对于Ruby1.8.7,这就可以了。url_1='http://www.youtube.com/watch?v=8WVTOUh53QY&feature=feedf'url

  3. ruby - 在 Mechanize 中使用 JavaScript 单击链接 - 2

    我有这个:AccountSummary我想单击该链接,但在使用link_to时出现错误。我试过:bot.click(page.link_with(:href=>/menu_home/))bot.click(page.link_with(:class=>'top_level_active'))bot.click(page.link_with(:href=>/AccountSummary/))我得到的错误是:NoMethodError:nil:NilClass的未定义方法“[]” 最佳答案 那是一个javascript链接。Mechan

  4. ruby - 如何从 URL 中删除 Google 跟踪参数 (UTM)? - 2

    我有一堆要清理的URL。它们都包含UTM参数,在这种情况下不是必需的,或者是有害的。示例:http://houseofbuttons.tumblr.com/post/22326009438?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+HouseOfButtons+%28House+of+Buttons%29所有可能的参数都以utm_开头。如何使用ruby​​脚本/结构轻松删除它们而不破坏其他潜在的“好”URL参数? 最佳答案 您可以将正则表达式应用于url以清

  5. javascript - jQuery 的 jquery-1.10.2.min.map 正在触发 404(未找到) - 2

    我看到有关未找到文件min.map的错误消息:GETjQuery'sjquery-1.10.2.min.mapistriggeringa404(NotFound)截图这是从哪里来的? 最佳答案 如果ChromeDevTools报告.map文件的404(可能是jquery-1.10.2.min.map、jquery.min.map或jquery-2.0.3.min.map,但任何事情都可能发生)首先要知道的是,这仅在使用DevTools时才会请求。您的用户不会遇到此404。现在您可以修复此问题或禁用sourcemap功能。修复:获取文

  6. ruby - jekyll 观看 haml 和 sass - 2

    我已经有一个在不同文件夹中包含.haml和.scss文件的项目。我按照这里的指南http://winstonyw.com/2013/02/24/jekyll_haml_sass_and_github_pages/创建了_plugins/haml.rb和_plugins/sass.rb我将我所有的.scss文件移动到./assets/css/文件夹中为了确保,我还创建了layouts文件夹并将所有.haml文件放在其中。我运行了jekyllserve--watch并且这些.haml/.scss文件没有在_sites中转换为.html或.css文件。我也无法通过浏览器访问它们。我在这里试过

  7. ruby-on-rails - 我将 Rails3 与 tinymce 一起使用。如何呈现用户关闭浏览器javascript然后输入xss? - 2

    我有一个用Rails3编写的站点。我的帖子模型有一个名为“内容”的文本列。在帖子面板中,html表单使用tinymce将“content”列设置为textarea字段。在首页,因为使用了tinymce,post.html.erb的代码需要用这样的原始方法来实现。.好的,现在如果我关闭浏览器javascript,这个文本区域可以在没有tinymce的情况下输入,也许用户会输入任何xss,比如alert('xss');.我的前台会显示那个警告框。我尝试sanitize(@post.content)在posts_controller中,但sanitize方法将相互过滤tinymce样式。例如

  8. ruby-on-rails - Rails Asset Pipeline 更好的错误或堆栈跟踪 - 2

    刚刚将应用程序从rails3.0.9升级到3.2.1,当我运行bundleexecrakeassets:precompile时出现错误,这很好,但是回溯没有告诉我在哪里语法问题来self的css或scss文件。我尝试对“0ee5c0e69c92af0”进行greping,但该字符串没有出现在我的项目中。bundleexecrakeassets:precompile:allRAILS_ENV=productionRAILS_GROUPS=assets--trace**Invokeassets:precompile:all(first_time)**Executeassets:precom

  9. ruby - 使用 Selenium WebDriver 启用/禁用 javascript - 2

    出于某种原因,我必须为Firefox禁用javascript(手动,我们按照提到的步骤执行http://support.mozilla.org/en-US/kb/javascript-settings-for-interactive-web-pages#w_enabling-and-disabling-javascript)。使用Ruby的SeleniumWebDriver如何实现这一点? 最佳答案 是的,这是可能的。而是另一种方式。您首先需要查看链接Selenium::WebDriver::Firefox::Profile#[]=

  10. ruby - 使用 gmail gem 跟踪一些电子邮件 - 2

    我正在使用gmailgem发送电子邮件,我需要跟踪这些电子邮件。我该怎么做?我正在尝试搜索带有message_id的电子邮件,但它会从我的收件箱中提取所有电子邮件,而我只想要特定电子邮件的回复。这是我的实际代码:*使用message_id保存电子邮件*mail=gmail.deliver(email)Email.create(:message_id=>mail.message_id,:from=>user.email,:to=>annotation.to,:body=>annotation.content,:title=>annotation.title,:annotation=>an

随机推荐