稍后通过python gdata库从youtube中删除视频

时间:2013-10-21 11:56:50

标签: python youtube

如何通过python gdata库从youtube中删除视频? 我检查API:https://developers.google.com/youtube/2.0/developers_guide_protocol?hl=en#Retrieving_watch_later_playlist, 并尝试其方法: 从播放列表中删除视频: https://gdata.youtube.com/feeds/api/users/default/watch_later/VIDEO_ID

通过python gdata库

playlist_uri = u"https://gdata.youtube.com/feeds/api/users/default/watch_later"
playlist_entry_id = videoID .............(Does watch later have playlist_entry_id??)
response = yt_service.DeletePlaylistVideoEntry(playlist_uri,
                                               playlist_entry_id)
=>Error: Bad request

playlist_uri = u"https://gdata.youtube.com/feeds/api/users/default/watch_later/%s" % videoID
response = yt_service.Delete("playlist_uri)
=>Error: Bad request

两者都失败了!

还有其他办法吗?非常感谢。

1 个答案:

答案 0 :(得分:0)

经过测试&一次又一次地尝试,在我的开发环境中可以成功执行的代码与Youtube文档非常不同:https://developers.google.com/youtube/2.0/developers_guide_protocol?hl=en#Retrieving_watch_later_playlist

仅供参考目的。
1.使用playlist_entry_id代替VIDEO_ID:
    - 如何获取以后观看的每个视频的playlist_entry_id?      。一般播放列表:entry.id.text.split('/')[ - 1]
     。观看以后的播放列表: entry.id.text.split('watch_later:')[ - 1]
2. API URL需要添加'?v = 2'

我的答案:
   playlist_uri = https://gdata.youtube.com/feeds/api/users/default/watch_later/ playlist_entry_id?v = 2
   自.__ ytService.Delete(playlist_uri)