I need get a list of most viewed music video on Youtube.
I used this API:
https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular®ionCode=US&videoCategoryId=10&key=[YOUR_API_KEY]
By default regionCode is US, I want get results by global.
Can someone help me?
You can't really using using the chart means you must include a reagion and the default is the USA.
string
The regionCode parameter instructs the API to select a video chart available in the specified region. This parameter can only be used in conjunction with the chart parameter. The parameter value is an ISO 3166-1 alpha-2 country code.
remove ®ionCode=US Should be the same as US
GET https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular&key=[YOUR_API_KEY]
You would have to query EACH region and take the videos with the highest cumulative viewCount over all regions. This would be difficult as different regions will have different music videos that are most popular. Unfortunately the API doesn't have a global regionCode option.
Related
i would like to crawl Youtube for videos of a specific language that contains subtitles/closed-captions(CC).
For example,
I want to crawl for 200 random English videos with English subtitles/(CC).
I want to crawl for 300 random Chinese videos with Chinese subtitles/(CC).
I want to crawl for 550 random Malay videos with Malay subtitles/(CC).
There's an api here that helps to extract transcripts, but the main bottleneck right now is that i have to go youtube to search for these videos and watch one by one to find out if they are indeed in the correct language, and if they really contain subtitles/CC.
An option is:
Use YouTube Data API - search request for search videos that contains subtitles; for that, use videoCaption parameter with value: closedCaption.
You might need use another parameters for reduce the search terms to specific topics or get certain desired results; for example, for the q parameter, use a search term that retrieves the desired results; also all parameters like: videoDuration, type = video, relevanceLanguage.
Once you got such results, copy/paste the videoId you got from the results of the request and use your web-crawler for get more videos and the related ones.
For anyone still struggling with this, and as per the YouTube Data API for videoCaption to work, you need to also set the type parameter's value to video:
If you specify a value for this parameter, you must also set the type
parameter's value to video.
It is possible?
I read the documentation, there are examples of receiving the number of views by country, but I need the number of views by city.
regionCode string
The regionCode parameter instructs the API to return search results for videos that can be viewed in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code.
The YouTube API only supports searching by region code that being ISO 3166-1 alpha-2 country code
No you cant search by city.
I need to fetch trending videos for a specific keyword with the Youtube API.
For example, videos that are trending for "Lebron James".
Can it be done via the Youtube API? Thanks!
Trending Videos
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&chart=mostPopular®ionCode=IN&key=API_KEY
1.part : The part names that you can include in the parameter value are id, snippet, contentDetails, fileDetails, liveStreamingDetails, localizations, player, processingDetails, recordingDetails, statistics, status, suggestions, and topicDetails.
chart :The chart parameter identifies the chart that you want to retrieve. (string) like 'mostPopular'
regionCode :The parameter value is an ISO 3166-1 alpha-2 country code. (string)
key : Google Project API key
Is there any way to have updated lists of top 100 videos of youtube by genre and/or by country!
Any kind of resources like json files or xml.
You'll want to use the chart parameter of the videos.list endpoint. Set the chart to mostPopular, and then include a regionCode parameter and videoCategoryId parameter for further narrowing down. For example,
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular®ionCode=UA&key={YOUR_API_KEY}
Will retrieve the 5 most popular videos in the Ukraine.
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular&maxResults=25®ionCode=DE&videoCategoryId=1&key={YOUR_API_KEY}
Will retrieve the 25 most popular videos in Germany that relate to Film/Animation. And so on.
Note that if you don't include a videoCategoryId parameter, it will return results from all categories. If you don't include a regionCode, it returns the most popular videos across all regions. You can only set videoCategoryId to a value that's valid in the region you're searching in (you can use the videoCategories.list endpoint to find valid categories for regions, languages, etc.)
I want to get images of cities when city name is entered in search field in iOS. I am using flickr API but whenever I enter any longitude and latitude values, I only get returned an empty array. What should I do. I am using this URL:
http://api.flickr.com/services/rest/?method=flickr.photos.geo.photosForLocation&api_key=e3d577010e5979a2ad2a22714abd901e&lat=40.6700&lon=73.9400&format=json&nojsoncallback=1&auth_token=72157638668602974-e1a3a3aa1e6d3dd8&api_sig=a0233b016c863b1662aeb21a664c351a
Please tell me what should I do. any help appreciated
I suspect that you are seeking too precise a match on your lat-long. Use the &accuracy parameter to specify a less precise match. (The default value of 16 specifies a very precise match.) Flickr suggests a value of 11 to match at the city level, so add
&accuracy=11
to your URL.
Update
I have not had any luck retrieving images with flickr.photos.geo.photosForLocation, but I have retrieved images by lat-long with flickr.photos.search. Note this comment in the documentation:
Geo queries require some sort of limiting agent in order to prevent
the database from crying. This is basically like the check against
"parameterless searches" for queries without a geo component.
A tag, for instance, is considered a limiting agent as are user
defined min_date_taken and min_date_upload parameters — If no limiting
factor is passed we return only photos added in the last 12 hours
(though we may extend the limit in the future).
Also remember that longitudes of places in the Western Hemisphere are specified as negative numbers.