Youtube API GetMostRecentVideoFeed()和GetMostViewedVideoFeed()方法的结果相同

2024-04-23 17:33:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在Youtube数据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");

然而,我得到的是每个feed中相同的视频列表(最近的、浏览次数最多的、回复次数最多的)。从“视频标题:查理又咬了我的手指”开始。你知道吗


Tags: txt标题视频titlefeedservicecounterfilename
1条回答
网友
1楼 · 发布于 2024-04-23 17:33:02

问题没有解决,但最终得到了解释。你知道吗

我使用的方法已经被否决了。 [https://developers.google.com/youtube/2.0/developers\u guide\u protocol\u video\u feeds\35;标准\u feeds]解释了为什么总是有相同的输出。你知道吗

All standard video feeds except the most_popular feed have been deprecated. In response to requests for other feeds, the API will return the most_popular feed with a default time parameter value of today.

相关问题 更多 >