1

If I search for "ten thousand islands mofro" on youtube, the desired video is the first result. However, I that video simply does not show up using Google's Youtube search API. Even when I search very specifically, it simply returns zero results. Here is my code:

var request = gapi.client.youtube.search.list({
    q: "ten thousand islands mofro",
    part: 'id, snippet',
    type: 'video'
});

Does this have something to do with copyright issues? But, if so, why would I be able to find it effortlessly on Youtube, yet not by using its API?

EDIT: It's definitely something to do with searching for music. Searching "harmonious funk blake aaron" also does not return the correct video, though it does when searching via the Youtube website. It looks like, for some reason, youtube channels with "- Topic" are not returned from the API. Still looking for workarounds or reasons as to why.

3 Answers 3

1

Whenever you don't get expected results, always try a direct URL request first.

https://www.googleapis.com/youtube/v3/search?part=id,snippet&type=video&key=API_KEY&q=ten+thousand+islands+mofro

gives plenty of results. Double check your code.

After OP comment: answer seems to be: 'region restrictions'.

Sign up to request clarification or add additional context in comments.

2 Comments

So, the issue isn't that I'm not getting results, it's that the desired video isn't returning from the query, even though it is the first one when searching from Youtube. My code, and the direct URL you just gave, does not return this video. However, that video is the first result if you search the same thing directly on Youtube.
You should have been more specific then. If you do a direct URL request for that particular video, you will see its region restrictions.
0

The answer ended up being that those videos were auto-generated by youtube, and the API does not find auto-generated videos (those videos will have "- Topic" appended to it). My workaround was to call an HTTP request from my server in order to find the video.

Comments

0

I solved it by adding "regionCode" parameter to my requset.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.