gpt4 book ai didi

python 类型错误 : unbound method UpdateVideoEntry() must be called with YouTubeService instance

转载 作者:行者123 更新时间:2023-12-01 05:56:01 24 4
gpt4 key购买 nike

我正在尝试使用 youtube api 更新条目。这是我正在努力解决的错误:

Traceback (most recent call last): File "", line 1, in updated_entry = gdata.youtube.service.YouTubeService.UpdateVideoEntry(YTVentry.id) TypeError: unbound method UpdateVideoEntry() must be called with YouTubeService instance as first argument (got NoneType instance instead)

这是我的代码:

    import gdata.youtube
import gdata.youtube.service
import gdata.youtube.data
client = gdata.youtube.service.YouTubeService()
...
videos_feed = client.GetYouTubeVideoFeed(uri)
for entry in videos_feed.entry:
print entry.title.text
YTentry = entry._GDataEntry__GetId
YTVentry = gdata.youtube.YouTubeVideoEntry(YTentry)
YTVentry.media.title = '09.11.2012 Hold me close'
YTVentry.media.description = '09.11.2012 : Hold me close section'
updated_entry = gdata.youtube.service.YouTubeService.UpdateVideoEntry(YTVentry.id)

根据 google gdata youtube 文档:

To update video meta-data, simply update the YouTubeVideoEntry object and then use the YouTubeService objects' UpdateVideoEntry method. This method takes as a parameter a YouTubeVideoEntry that contains updated meta-data.

提前致谢。

最佳答案

    updated_entry = gdata.youtube.service.YouTubeService.UpdateVideoEntry(YTVentry.id)

应该是

    updated_entry = client.UpdateVideoEntry(YTVentry.id)

gdata.youtube.service.YouTubeService.UpdateVideoEntry(YTVentry.id) TypeError: unbound method UpdateVideoEntry() must be called with YouTubeService instance as first argument (got NoneType instance instead)

该错误是因为您尝试从类而不是您创建的客户端对象调用 UpdateVideoEntry。您已经创建了一个 YouTubeService 对象 client,您需要使用它,而不是直接调用类的方法。

关于python 类型错误 : unbound method UpdateVideoEntry() must be called with YouTubeService instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12568342/

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