Searching for music videos yields many results that are not music videos - e.g. interviews with the searched for artist. In my opinion only music videos should be in the Music category, or there should be a separate category for Music videos, or videos should be tagged with multiple categories upon which we can logically filter.
Is there any functionality/filter which I can use along with the API to return only the music videos.
Following is my code:-
def search_videos(self,keyword,maxResults=10):
youtube = build('youtube','v3',developerKey=KEY)
response = youtube.search().list(q=keyword,
part="id,snippet",
maxResults=maxResults
).execute().get("items", [])
videos = []
for record in response:
if record["id"]["kind"] == "youtube#video":
title = record["snippet"]["title"].encode(encoding='UTF-8',errors='strict')
youtube_id = record["id"]["videoId"].encode(encoding='UTF-8',errors='strict')
videos.append({
'youtube_id': youtube_id,
'title' : title
})
return videos
In your search, you could specify the
videoCategoryId
, which is supposed to only give you results specific to that category (but I think it's slightly bugged now) in addition to having the keyword "music video", which I hope gives you more relevant results. If you want to try it, the videoCategoryId for music is "10" (assuming you're in the US). Note that you will also have to specifytype=video
. Other than that, I'm not sure what else you can do besides trying to get more visibility on the issue the others have posted.I don't think you can achieve that using a keyword based search. Category here is 'music' and that means that anybody who categorises their video with the tag 'music' will end up being a 'music video' and show for that category.
Also, I think your problem is similar to this - https://code.google.com/p/gdata-issues/issues/detail?id=5341. You can follow up and request, but it may not be feasible without some sort of rating system.
No there is not. Users tag their own videos with categories, so you can't rely on a video matching your expectation of a category, even if the meaning of the category seems clear.
See this post, which something tells me you've already seen. =)