使用Python GData API,无法获得可编辑的视频条目

Kry*_*ski 3 python youtube django gdata-api gdata

我无法获得包含链接rel ="edit"的视频条目.我需要这样一个条目才能调用DeleteVideoEntry(...)它.

我正在使用检索视频GetYouTubeVideoEntry(youtube_id=XXXXXXX).我的yt_service使用用户名,密码和开发人员密钥进行初始化.我使用ProgrammaticLogin.这部分似乎工作正常.我使用相同的yt_service来提前上传所述视频.此外,如果我将开发人员密钥更改为虚假(在调试期间)并尝试进行身份验证,我会收到403错误.这让我相信认证工作正常.

不用说,检索到的视频条目GetYouTubeVideoEntry(youtube_id=XXXXXXX)不包含编辑链接,我不能在DeleteVideoEntry(...)通话中使用该条目.

是否有一些特殊的方法来获取一个视频条目,其中包含一个带有rel ="edit"的链接元素?有谁能建议某种方法来解决我的问题?这可能是一个错误吗?

更新:

对于记录,当我尝试获取所有上传的源,然后循环浏览视频条目时,视频条目确实有一个编辑链接.所以使用这个工作:

uri = 'http://gdata.youtube.com/feeds/api/users/%s/uploads' % username
feed = yt_service.GetYouTubeVideoFeed(uri)
for entry in feed.entry:
   yt_service.DeleteVideoEntry(entry)
Run Code Online (Sandbox Code Playgroud)

但这不是:

entry = yt_service.GetYouTubeVideoEntry(video_id = video.youtube_id)
yt_service.DeleteVideoEntry(entry)
Run Code Online (Sandbox Code Playgroud)

使用相同的yt_service.

Ale*_*ich 6

我刚刚使用gdata和ProgrammaticLogin()删除了youtube视频

以下是重现的一些步骤:

import gdata.youtube.service
yt_service = gdata.youtube.service.YouTubeService()

yt_service.developer_key = 'developer_key'
yt_service.email = 'email'
yt_service.password = 'password'
yt_service.ProgrammaticLogin()


# video_id should looks like 'iu6Gq-tUsTc'
uri = 'https://gdata.youtube.com/feeds/api/users/%s/uploads/%s' % (username, video_id)  
entry = yt_service.GetYouTubeUserEntry(uri=uri)
response = yt_service.DeleteVideoEntry(entry)
print response  # True
Run Code Online (Sandbox Code Playgroud)

yt_service.GetYouTubeVideoFeed(uri)是因为GetYouTubeVideoFeed不检查uri而只是打电话self.Get(uri, ...)但是原来,我认为,它是预期的'https://gdata.youtube.com/feeds/api/videos'uri.

反之亦然yt_service.GetYouTubeVideoEntry()使用YOUTUBE_VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos',但此项目不包含rel="edit"

希望能帮到你