1

A have a little problem/question.

Im trying to retrieve the most videos from the youtube api, but it seems that my output are not correct. when I'm using this url http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed i get a lot of videos with many views, but not all i think. for example the extreme popular video gangnam style are not present even though it has many more views than some of the other videos in the result. Is it because i use a wrong url or do i get old data or something else??

EDIT: code

feed = yt_service.GetYouTubeVideoFeed('http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed')
for entry in feed.entry:
     print entry.statistics.view_count, ' : ', entry.media.title.text
freddy
  • 394
  • 1
  • 5
  • 19

2 Answers2

2

Try the URL http://gdata.youtube.com/feeds/api/videos?orderby=viewCount instead.

codeape
  • 97,830
  • 24
  • 159
  • 188
  • Thx just the one i was looking for :) – freddy Oct 11 '12 at 11:24
  • This worked for me for a while, then i put this project on pause and now it doesn't work. The link above http://gdata.youtube.com/feeds/api/videos?orderby=viewCount doesn't return the right result. e.g. Gangnam style is not in the result. What should I then use? – freddy Dec 06 '12 at 22:36
  • Gangam style is the first result.. search for 9bZkp7q19f0 in file. – Kuber Jun 19 '14 at 11:30
  • 1
    Looks like the API has been replaced with YouTube Data API v 3. https://developers.google.com/youtube/v3/getting-started – codeape Jul 28 '15 at 07:41
0

Try out below code:

import requests
import json
payload = {'part': 'snippet', 'key': DEVELOPER_KEY, 'order':'viewCount', 'q': 'gangnam style', 'maxResults': 10}
l = requests.Session().get('https://www.googleapis.com/youtube/v3/search', params=payload)    
resp_dict = json.loads(l.content)
print resp_dict['items']
for i in resp_dict['items']:
     print "Title: ",i['snippet']['title']
josepainumkal
  • 1,613
  • 1
  • 16
  • 23