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

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.

Related

PHP Youtube API: Search videos where a URL is within the description

I'm working on a site where they have recently changed their domain. I'm trying to get a list of all the videos that contain that domain and change to the new domain using the Youtube API.
I am using the developers PHP example on search list, changing the 'q' value to be equal the old website domain and also adding a channelId parameter so that it'll only search inside their channel.
The problem is that some of the results do not contain the old URL in the description. Am I doing something wrong?
Thanks!
AFAIK there isn't any official YouTube Data API v3 endpoint to directly do what you are trying to.
If I were you I would list the YouTube channel's videos and then use Videos: list with part=snippet to retrieve their descriptions and then I would locally filter the retrieved descriptions.

Is there a way to get a list of Youtube videos sorted by view count

I am trying to collect a large list of YouTube's most watched videos for a data science application. I tried to use the YouTube Data API with the following query:
https://www.googleapis.com/youtube/v3/search&order=viewCount&type=video&regionCode=US&key=API_KEY,
but it does not seem to give me the same video ideas as in this list: https://en.wikipedia.org/wiki/List_of_most-viewed_YouTube_videos
Could someone tell me how I should do it?
Using the Search.list API endpoint is one way to search for the most viewed videos pertaining to a given region.
There's another endpoint -- Videos.list -- that, when queried with chart set to mostPopular, gives back:
chart (string)
The chart parameter identifies the chart that you want to retrieve.
Acceptable values are:
mostPopular – Return the most popular videos for the specified content region and video category.
As per the specification of videoCategoryId:
By default, charts are not restricted to a particular category.
Therefore, you may safely invoke Videos.list with chart=mostPopular and regionCode=US, without passing to it any videoCategoryId.
These two are the only API means that accomplish the task described by your post.

Get youtube old trending videos

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&

Youtube API v3 Return Lat/Lng

I can search lat/long with YouTube v3 successfully,
https://www.googleapis.com/youtube/v3/search?part=snippet,id&maxResults=50&type=video& videoType=any&key=foobar&location=40.7127,74.0059&locationRadius=100km
However, the response doesnt give me the individual videos lat/lng in the results.
The API doc says:
The part parameter specifies a comma-separated list of one or more
search resource properties that the API response will include. Set the
parameter value to snippet.
I cannot find any other search resource properties besides id and snippet in Search:list.
(Why would the API include that first sentence if there are only 2 options?) I digress.
Question-
Is there any way that I can retrieve YT videos lat/long based on lat/long search?
You can have lat/long parameters of the videos you own or manage. But due to privacy reasons (been able to locate people from their uploads.) you won't be able to get specific geolocations of other people's uploads.

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