我正在尝试在 Youtube Data API 中保存有关视频提要的信息。(例如,供稿中每个条目的视频标题并将其保存到文件中)。
def SaveFeed(feed,filename):
with open(filename,"w") as f:
counter = 0;
for e in feed.entry:
counter += 1;
f.write("\n\n===================================\n")
f.write("Counter: "+ str(counter) + '\n');
file.write('Video title: %s\n' % e.media.title.text)
yt_service = gdata.youtube.service.YouTubeService()
yt_service.ssl = True
feed = yt_service.GetMostRecentVideoFeed();
feed2 = yt_service.GetMostViewedVideoFeed();
feed3 = yt_service.GetMostRespondedVideoFeed();
feed4 = yt_service.GetMostDiscussedVideoFeed();
SaveFeed(feed,"mostrecent.txt");
SaveFeed(feed2,"mostviewed.txt");
SaveFeed(feed3,"mostresponded.txt");
SaveFeed(feed4,"mostdiscussed.txt");
但是,我得到的是每个提要中相同的视频列表(最近的、观看次数最多的、回复最多的)。从“视频标题:查理咬我的手指 - 又一次!”开始。