vedrano
vedrano

Reputation: 2971

Cannot search YouTube videos by developer tag

Search https://gdata.youtube.com/feeds/api/videos?category=%7Bhttp://gdata.youtube.com/schemas/2007/developertags.cat%7Dmy_developer_tag&v=2&key=my_developer_key by developer tag does consistently return 0 results. Developer tag exists in at least one video I am looking for.

...<openSearch:totalResults>0</openSearch:totalResults>...

It is pretty good explained in documentation https://developers.google.com/youtube/2.0/developers_guide_protocol_category_keyword_browsing#Browsing_with_Categories_and_Keywords but it simply does not work

I am sending my developer key in both 'X-GData-Key' header and 'key' parameter in URL and I have tested a few days after video upload, so it is not a matter of propagation time.

Request is authenticated what I can confirm by getting developer tag when I issue query based on generic search phrase.

My simple question is how to search all YouTube videos by developer key so I can select only videos uploaded by my application?

Upvotes: 0

Views: 612

Answers (2)

vedrano
vedrano

Reputation: 2971

Unfortunately, there is no time delay or some other delay at all. Videos simply cannot be searched by developer tag. I ended up setting subject of the video to my identifier, so I search all videos with that specific identifier as a generic query and eliminate ones that do not contain developer tag. So it exists, but cannot be searched by.

Upvotes: 0

Jeff Posnick
Jeff Posnick

Reputation: 56034

I just tested the documented behavior and things are working as expected for me. It takes a couple of hours for the video to show up in the search index, but once it does, developer-tag based searches also find it.

You can determine whether a video has made it into the search index or not by requesting http://gdata.youtube.com/feeds/api/videos?v=2&q=VIDEO_ID and trying every so often until it returns a result. (That assumes the VIDEO_ID doesn't start with a '-' character...)

Once you're sure it's in the index, a request for https://gdata.youtube.com/feeds/api/videos?category=%7Bhttp://gdata.youtube.com/schemas/2007/developertags.cat%7DDEVELOPER_TAG&v=2&key=DEVELOPER_KEY should return it. You don't need to include Authorization headers when doing that search—you just need to make sure you're using the same DEVELOPER_KEY and DEVELOPER_TAG values you used when performing the initial upload.

Upvotes: 1

Related Questions