gpt4 book ai didi

youtube - 经OAuth2验证后删除YouTube收藏夹

转载 作者:行者123 更新时间:2023-12-03 06:02:32 30 4
gpt4 key购买 nike

我正在尝试使用YouTube API删除收藏夹。随着Google最近弃用AuthSub身份验证方法,我决定选择官方推荐的OAuth2身份验证方法。

我可以将视频设置为收藏视频,但是当我尝试使用the described method in the docs删除视频时,响应为:

Only the favorite owner can remove it.

我正在使用 Google OAuth2 Playground,并且能够将视频设置为收藏夹,因此我非常确定身份验证没有错误,但是仍然无法正常工作。

我的要求如下:
DELETE /feeds/api/users/default/favorites/nq3gs6PG8-E HTTP/1.1
Host: gdata.youtube.com
X-gdata-key: key=DEVELOPER_KEY
Content-length: 0
Authorization: OAuth ACCESS_TOKEN
----------------------------------------
HTTP/1.1 403 Forbidden
Content-length: 38
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
X-google-cache-control: remote-fetch
-content-encoding: gzip
Server: GSE
Reason: Forbidden
Via: HTTP/1.1 GWA
X-gdata-user-country: US
Cache-control: private, max-age=0
Date: Thu, 20 Sep 2012 17:53:19 GMT
X-frame-options: SAMEORIGIN
Content-type: text/html; charset=UTF-8
Expires: Thu, 20 Sep 2012 17:53:19 GMT

Only the favorite owner can remove it.

我确实将“nq3gs6PG8-E”视频设置为收藏视频,并且我的DEVELOPER_KEY和ACCESS_TOKEN是正确的。

我想知道是否有修复程序,或者我缺少什么?我不想回退已过时的身份验证方法,这并不安全,但是我有什么选择吗?

最佳答案

请参阅https://developers.google.com/youtube/2.0/developers_guide_protocol_favorites#Deleting_a_favorite_video

具体来说,此注释:

The ID that you use to delete a favorite video is not the for that video but a different value that uniquely associates the video with the user who marked it as a favorite. To delete a favorite video, always send the DELETE request to the edit URL that the favorite videos feed specifies for the video.

关于youtube - 经OAuth2验证后删除YouTube收藏夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12518505/

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