views:

49

answers:

1

Hello,

I'm trying to use the google-api-java-client (I suppose this is what is referred to as 2.0) for writing an android application for youtube. (gdata-java-client (1.x) does not support android, I understand). I have loooked through the youtube documentation as well as the sample provided in "youtube-jsonc-sample", which only queries based on the .

I want to query for youtube videos, as detailed at http://code.google.com/apis/youtube/2.0/developers_guide_java.html#Searching_for_Videos The sample snippets described there however seem to be for the older gdata API. I do not find anything related to youtube in google-api-java-client except for the youtube sample. The reference at code.google.com/apis/youtube/2.0/reference.html#Searching_for_videos too makes only a fleeting reference to "conditions that should be used to filter the result set."

Is it possible to query youtube videos using the 2.0 API (on android) ? Please point me to pointers or sample code.

Thanks;

A: 

The best sample for YouTube right now is the youtube-jsonc-sample, which shows how to search for YouTube videos using the JSON-C format. Though it is written to run on the command-line, it should work almost unmodified on Android. You mention this sample, but not why it doesn't meet your needs. Would you kindly expand on that?

Yaniv Inbar
I have looked through youtube-jsonc-sample, and have actually got it working on android. I was trying to see if I can get the youtube Data API as described in http://code.google.com/apis/youtube/2.0/developers_guide_java.html working on android too, specifically about searching for videos. I understand this is NOT possible. I, however, have found a way of using the jsonc-sample code indirectly to search for videos, as YouTubeUrl.relativeToRoot("videos?q=" + query_string). Let me know if there's a better way.
Kumar
The only problem is that it would fail if query_string needs to be escaped. Better would be to add an "@Key public String q" field to YouTubeUrl and then call "url.q=query_string" and the escaping will be taken care of for you.
Yaniv Inbar