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.
Related
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.
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®ionCode=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.
How can I retrieve all Arabic speaking channels locally in Israel.
Using the API explorer, I don't see such an option.
Which fields are mandatory for search to call the search API?
Is there any way to fulfill this task?
Update:
API Explorer
I couldn't get results
There are lots of parameters in the API v3 Docs for Search that you can play around with, some in particular you might find helpful are:
location
locationRadius
regionCode
relevanceLanguage
and you'll need to set type = "channel" to return only channels.
The only mandatory parameter is part which is what data you want returned from your results. For this search call, you only have one option for part, which is "snippet".
This is the only way to do it simply within your multiple parameters, and it will take 100 quota per search, assuming you have an API key already.
If you press 'Try This API' on the right, it'll even give you code snippets you can copy in a variety of languages, since you didn't specify one in the prompt.
Depending on the language, a call could look like the following:
GET https://youtube.googleapis.com/youtube/v3/search?part=snippet&location=Israel®ionCode=IL&relevanceLanguage=ar&type=channel&key=[YOUR_API_KEY] HTTP/1.1
I'm interested in getting topics as part of the results when searching with:
https://www.googleapis.com/youtube/v3/search?
For instance, when searching Dance Music on the YouTube website, it shows some videos and on the side there's a Electronic Dance Music topic showing up.
How can I get that using the API?
I'll also be fine search for topics in a different API call.
Use the Search: list method which returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource such as the topicId parameter.
The topicId parameter indicates that the API response should only contain resources associated with the specified topic. The value identifies a Freebase topic ID.
Important: Due to the deprecation of Freebase and the Freebase API, the topicId parameter started working differently as of February 27, 2017. At that time, YouTube started supporting a small set of curated topic IDs, and you can only use that smaller set of IDs as values for this parameter.
You may use the API Explorer to try the sample request.
I'm using the Twitter search api to search for a keyword so I can grab all the tweets containing that keyword. I also need to find the location of these tweets. Is this possible? I've looked through the JSON and the 'Geo' property is always null - i'd be happy to just use the location that the user has filled out in their profile but I can't see that this is available through the search api.
I've seen lots of apps that allow you to find tweets nearby based on your location but I want to do something different. find tweets by keyword and then find their location.
Is this possible?
Apologies, just found a solution.
The REST api allows me to query based on a search string:
http://search.twitter.com/search.json?&q=twitter
and this returns some json including the user id and then from there I can query again using this:
http://api.twitter.com/1/users/show.xml?user_id=1401881
which returns me user info including a location.