Get youtube old trending videos - youtube-api

Working with YouTube Data API v3, to get the most popular videos i'm using:
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&chart=mostPopular&regionCode=IN&maxResults=25&key=API_KEY
But i need old trending video by a specific date.
I tried publishedBefore=2016-09-21 but it gives today trending videos.
Update: if this is not possible with YouTube Data API just a website/ database where i can find old youtube trending by date and country will do it for me.
Update2: using search not working because i don't need a keyword
Please Help

Don't think publishedBefore works in videos.list. You are using Videos.list API call but this doesn't have a publishedBefore property. This filter only exist in Search.list. However, I've noticed there's no mostPopular parameter in Search.list as well.
So, what I can suggest is use the order paramter with "rating" as value in Search.list.
Here's a sample URL call:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=25&order=rating&publishedBefore=2016-01-01T00%253A00%253A00Z&q=dogs&type=video&fields=*&_h=8&

Related

Location - latitude longitude format for youtube data v3 api - api explorer

I want to find youtube videos by their latitude, longitude and locationRadius.
Youtube data api docs- do mention about this parameter.
But when I try to use the exact same format in the api explorer,
What should I do?
It gives this silly error.
According to YouTube Data API v3 Search: list part is mandatory but it's not the case and type=video seems mandatory while not being described as such.
So the following works: https://www.googleapis.com/youtube/v3/search?location=37.42307,-122.08427&locationRadius=12km&type=video&key=YOUR_API_KEY
The type parameter restricts a search query to only retrieve a
particular type of resource. The value is a comma-separated list of
resource types. The default value is video, channel, playlist.
Acceptable values are:
channel
playlist
video
As spotted by #Probosckie channel and playlist don't seem to work with my solution.

YouTube API "mostPopular" requests doesn't seem to give updated results

It seems that the YouTube API doesn't give updated results for mostPopular videos in my country since few days.
Example:
This request (https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&chart=mostpopular&regionCode=FR) doesn't give me the same videos results than the ones displayed directly on YouTube for the French most popular channel (https://www.youtube.com/channel/UCmzy72gDEpfXoFV9Xdtd0DQ). It seems that the results of this request is not updated since the 1th of february. Results was real time updated before this.
Does someone know if something is wrong with my API request, or if there are some issues with the YouTube API at this moment?
There is nothing wrong with your request. This is a known issue with the YouTube API reported here for Saudi Arabia (but also applicable to multiple regions), and another related issue here with regard to content from France.
Your best bet would be to follow up with the YouTube team on one of those defects, or potentially (and dangerously) scrape the YouTube site for the correct results.
Problem seems to be solved since 13th of february (maybe someone from Google have seen my post..)
YouTube Channels and chart=mostPopular parameter data are separate data entities, aka you will get different results. They may be related but there is no guarantee you will get the same data. To get the data that you want you may need to query for channel itself and its videos.
I got this information from the thread #Jal linked, there was an update by matthewc...#google.com a few days ago:
The most popular channel for Saudia
Arabia and
the mostPopular chart parameter in the video.list
call
are separate and distinct entities. If you'd like to get the content
of the most popular channel for Saudia
Arabia
please use the Data API video.list call to list the videos with the
channel ID (in this case "UCWY-_j1MCth6yf24m58Bh_Q") by setting the
items/snippet/channelId parameter.
My current concern right now is that there is supposedly a way to get video information from the videos.list endpoint using a channelId, which does not seem the case in the API Explorer. I will update my answer once I figure out what this person meant exactly.

Output last and popular youtube videos on site ? any api?

I want to output last videos and popular videos of my youtube channel.
Is there any standart widget, api method for this?
Based on this answer, you can use the YouTube Data V3 API to get the uploads playlist ID, which you can then use to get the latest videos in that playlist. You can change the value of maxResults to return however many videos you want (from 0 to 50).
Use the search:list method to get your most viewed videos by specifying the channel ID and setting order=viewcount (not quite sure what you want when you say popular videos, you could also set order=rating to get the highest rated videos). This video might also help you out.

PHP Youtube API v3 Missing Description in Playlist Items

I'm not getting the description form my uploaded videos when i query them via Youtube Data API v3 using OAuth 2.0 and the sample code provided here https://developers.google.com/youtube/v3/docs/playlistItems/list.
Could this be a bug? None of my videos are private and the only thing that is missing from the response is the video's description!
I'm using the PHP library and the "part" parameter is snippet (don't know if this helps).
Thanks in advance.
I believe this is intended, since video descriptions are not displayed when viewing playlists on YouTube.
If you wish to include the description of your uploaded videos, consider using YouTube API v3 Search: list instead. An ellipsis-truncated description will be provided for your videos under snippet/description. Again, this behaviour is similar to searching on YouTube, where descriptions are cut off.
If a full description is required, you'll need to use Videos: list.
Alternatively, use version 2 of the API: https://gdata.youtube.com/feeds/api/users/youtube_username/uploads?max-results=50&start-index=1.

Channel Search in Youtube Data API within a particular category

I want to get all the channels within one particular category say "X".How can i achieve this using youtube data API?
Getting all the channels is easy and we can get these on the basis of searched keyword.
With the Youtube API v3 the channels can be filtered by the Freebase topic ID, besides keyword
https://developers.google.com/youtube/v3/docs/search/list

Resources