YouTube API is not giving accurate video results - youtube-api

Getting video in the results even though it didn't match query parameter(q)
The parameter i passed didn't exists in body,title,tags, But the video is relavant. Is API looks any other metadata of video.
For Example: i have given parameter as "mobile", this video https://www.youtube.com/watch?v=j8UNo3vRIB0 is coming as result, here video title and description not contain mobile as parameter
Latest data not coming consistently in youtube api
Some times latest data not coming in youtube data api.
For Example: i have given rule as "amazon". This video https://www.youtube.com/watch?v=6zygd1iW-f4 is showing in youtube website's latest videos but not coming in youtube api result.
Example query: https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&q=amazon&maxResults=50&type=video&key=xyz

W.r.t. point (1), Youtube is working OK, since the content of that video is related to the keyword mobile (please convince yourself by watching the first couple of minutes of that video).
For what concerns your point (2), I cannot in any way make the Youtube site to produce the video 6zygd1iW-f4 near the top of its search result set for the query term amazon.
All in all, I deem your claims above unsustainable.
Please note that one cannot expect crisp results from Youtube when queried with such general terms as yours is. One should not expect Youtube's searching feature to work similarly to say a full-text search in single computer-stored database. There will always be a degree of fuzziness associated to querying Youtube for broad terms.

You are actually stumbling on a very tricky scenario. Your goal is to get the same results via the API that you also see on YouTube’s website, right?
First, make sure that you configured the search endpoint as identical to your YouTube user account as possible:
order: relevance
relevanceLanguage: Same as the language that you set in the menu of YouTube’s website (Use a ISO 639-1 2-letter Code)
regionCode: Same as the country that you set in the menu of YouTube’s website (Use a ISO 3166-1 2-letter Code)
With these settings you will see that the results will be quite similar. But still not identical. Not because the API is not working or is still not properly configured but rather because YouTube’s search results change all the time. Just do the same exact search on YouTube’s website just 10 seconds apart. You’ll see that you get different search results.

Related

YT search API to search for Arabic speaking channels locally in Israel

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&regionCode=IL&relevanceLanguage=ar&type=channel&key=[YOUR_API_KEY] HTTP/1.1

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.

YouTube API v3 Order Parameter Possible Bug

Looking at the YouTube API v3 Search documentation, it states that the order parameter is used to control ordering of API response resource results. However, when attempting to order by date, I'm not receiving the results in reverse chronological order as specified. In fact, they are not in any order whatsoever.
API Request with order date using API Explorer UI:
Is there some other way I should be requesting for results to be ordered by the time they were published on YouTube? Is there a bug in the handling of the order API parameter?
There's no bug; the 'order' parameter will sort results based on when the resources were created, This value may be slightly different than when a video is published, as a resource is created when an upload begins but a video is published when the upload finishes and is processed.
In this case, it looks like the 10 or so most recent videos were all uploaded at the exact same time (YouTube.com has a batch uploader), so you're getting the order they were created in, even though the published dates reflect minor differences (maybe a couple took a bit longer to upload or something). IF you scan the full list of results, though, you'll see they play out just fine in terms of their reverse chronological order. And generally you probably won't have so many videos that were batch uploaded like this.

About YouTube search list API V3

In my application, I have used youtube.search.list API v3 for searching whole videos included in specific channel.
Example:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=[CHANNEL_ID]&q=[KEYWORD]
'q' is parameter for search keyword.
In my case, I used only 'q=' without keyword because I'd like to search whole videos.
It's working well at least until yesterday(27.Aug). but now, the server response is always 'totalResults: 0'
Could you tell me whether it's temporary wrong operation or the policy about this API is changed?
You can test above problem in the below url :
http://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet
The issue has been reported to the gdata issues list five times in the last 24 hours or so. Regardless of whether it's deliberate or not, there's a lot of people concerned.
The first instance report:
https://code.google.com/p/gdata-issues/issues/detail?id=6598

Youtube API search

I have been trying out the youtube API with Java. When I do a search using the API I don't get the same results as when I just type the keyword in the browser, any logical explanation why this is?
Compare: http://www.youtube.com/results?search_query=blah+&aq=f
http://pastebin.com/FVRd3URT (list of video Titles)
I also noticed that some videos (or at least their title) are duplicated.
YouTube API version 3 gets the same search results. Version 3 is still experimental, according to the documentation. https://developers.google.com/youtube/v3/docs/search/list
No, it's just how it is. Trying to match up the two is a futile exercise.
Amazon search has the same problem.
This demo might help.
https://github.com/bitsabhi/YouTubeDemo
A java project to return title, album, you tube link when the user searches for any songs. Uses You tube search API.
I have the same problem.
It is as if the API queries don't support full text search - results through the API are the same as if you enter "my search query" in quotes.
Although, try setting a slightly larger time frame: 'today' might be different from 'last_week', and you may get more relevant results.

Resources