私はYouTube ビデオのリストをフェッチしたいアプリを書いています。以下のリンクのような特定のユーザーのアカウントを使用してそれを行うことができます:
 HttpUriRequest request = new HttpGet("http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads?v=2&alt=jsonc");
しかし、プレイリストを使用してYouTubeビデオのリストを取得したい場合、コードで行う必要がある変更は何ですか.ここのように、ビデオを取得するためにユーザー名は必要ありません.
  http://gdata.youtube.com/feeds/api/playlists/PL1D5B07DD840FB46D?v=2&alt=json
元のリンク: http://www.youtube.com/playlist?list=PL1D5B07DD840FB46D
私のコード:
  public class GetYouTubeUserVideosTask implements Runnable {
public static final String LIBRARY = "Library";
private final Handler replyTo;
private final String username;
public GetYouTubeUserVideosTask(Handler replyTo, String username) {
    this.replyTo = replyTo;
    this.username = username;
}
@Override
public void run() {
    try {
        HttpClient client = new DefaultHttpClient();
        HttpUriRequest request = new HttpGet("http://gdata.youtube.com/feeds/api/playlists/PL1D5B07DD840FB46D?v=2&alt=json");   
        HttpResponse response = client.execute(request);
        String jsonString = StreamUtils.convertToString(response.getEntity().getContent());
        JSONObject json = new JSONObject(jsonString);
        JSONArray jsonArray = json.getJSONObject("data").getJSONArray("items");
        List<Video> videos = new ArrayList<Video>();
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            String title = jsonObject.getString("title");
            String url;
            try {
                url = jsonObject.getJSONObject("player").getString("default");
            } catch (JSONException ignore) {
                url = jsonObject.getJSONObject("player").getString("default");
            }
            String thumbUrl = jsonObject.getJSONObject("thumbnail").getString("sqDefault"); 
            videos.add(new Video(title, url, thumbUrl));
        }       
        Library lib = new Library(username, videos);
        Bundle data = new Bundle();
        data.putSerializable(LIBRARY, lib);
        Message msg = Message.obtain();
        msg.setData(data);
        replyTo.sendMessage(msg);
    } catch (ClientProtocolException e) {
        Log.e("Feck", e);
    } catch (IOException e) {
        Log.e("Feck", e);
    } catch (JSONException e) {
        Log.e("Feck", e);
    }
}
   }