【问题标题】:retrieve video (categoryID) from youtube using json使用 json 从 youtube 检索视频(categoryID)
【发布时间】:2013-05-12 08:36:21
【问题描述】:

我想从我的应用上传 youtube 视频并在之后找到这些视频。

为此,我使用v3 youtube api上传了视频

这里是用于添加标题、描述等的部分代码

 snippet.setTitle("Test Upload via Java on " + cal.getTime());
      snippet.setDescription(
          "Video uploaded via YouTube Data API V3 );

      // Set your keywords.
      List<String> tags = new ArrayList<String>();
      tags.add("test");
      tags.add("example");
      tags.add("java");
      tags.add("YouTube Data API V3");
      tags.add("erase me");
      snippet.setTags(tags);

我想添加 catagotyid 所以我只是添加:

snippet.setCategoryId("test");

此时上传代码停止工作,为什么?

to retrieve all the video that upload by my app i need to fill in part line "snippet" (without Quotes) and in id line add my category id like "test" (without Quotes), and then result catch by json ?

更新:

我应该如何填写 "try it!" ?接收类别 ID 列表,并假设我得到了列表,我怎么知道要选择哪个类别?,我想我错过了一些东西,我不知道是什么

【问题讨论】:

    标签: android json youtube-api android-youtube-api


    【解决方案1】:

    对此尝试 GET 请求:

    https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=US&key={YOUR_API_KEY}
    

    当然你用你的密钥替换{YOUR_API_KEY}。你应该得到这样的东西:

    {
     "kind": "youtube#videoCategoryListResponse",
     "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/jOw8Jx4EQq_udW-0UgiRcCMWqWQ\"",
     "items": [
      {
       "id": "1",
       "kind": "youtube#videoCategory",
       "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/gljmmWdkbtlCrMi74KVYLrbTaIA\"",
       "snippet": {
        "channelId": "UCBR8-60-B28hp2BmDPdntcQ",
        "title": "Film & Animation"
       }
      },
      {
       "id": "2",
       "kind": "youtube#videoCategory",
       "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/n1RtRMaPpKgph8MvS9wf742Tm5U\"",
       "snippet": {
        "channelId": "UCBR8-60-B28hp2BmDPdntcQ",
        "title": "Autos & Vehicles"
       }
      },
      {
       "id": "10",
       "kind": "youtube#videoCategory",
       "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/1LzYK9Uf9Nt0hzBqNqhuHw0LPI0\"",
       "snippet": {
        "channelId": "UCBR8-60-B28hp2BmDPdntcQ",
        "title": "Music"
       }
      },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-15
      • 1970-01-01
      • 2013-07-02
      • 1970-01-01
      • 1970-01-01
      • 2013-07-08
      • 2014-09-29
      • 2022-01-12
      相关资源
      最近更新 更多