lundi 20 juillet 2015

How to exclude the video result that doesn't have videoId

Now, I'm using Youtube API V3 to fetch the result by particular search keyword.
It returns result but it sometimes contains playlistId instead of videoId.
So that I get nil for that and it shows only 9 videos instead of 10.
How can I avoid that and fetch only the videos that contains videoId not playlistId?

this is my current code

@search_response = client.execute!(
  :api_method => youtube.search.list,
  :parameters => {
    :part => 'snippet',
    :q => 'cats',
    :maxResults => 20,
    :order => 'date',
    :pageToken => pageToken
  }
)

Aucun commentaire:

Enregistrer un commentaire