2015-09-20 199 views
1

當我使用https://developers.google.com/youtube/v3/docs/channels/list頁上的測試表單獲取我的上傳ID時,我沒有在輸出中獲取上傳ID信息。youtube-v3-api頻道列表錯誤

200 OK 
- HIDE HEADERS - 
cache-control: private, max-age=0, must-revalidate, no-transform 
content-encoding: gzip 
content-length: 184 
content-type: application/json; charset=UTF-8 
date: Sun, 20 Sep 2015 05:09:05 GMT 
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4" 
expires: Sun, 20 Sep 2015 05:09:05 GMT 
server: GSE 
vary: Origin, X-Origin 
{ 
"kind": "youtube#channelListResponse", 
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4\"", 
"pageInfo": { 
    "totalResults": 0, 
    "resultsPerPage": 5 
}, 
"items": [ 
] 
} 

命令用於生成這個請求是

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=StraconisChannel 

,混淆我的是我在做同樣的事情由一個教程,我下面的建議的一部分,我的唯一的事情m改變是頻道名稱,並改用我的頻​​道名稱。他看起來就像這樣:

200 OK 
- HIDE HEADERS - 
cache-control: private, max-age=0, must-revalidate, no-transform 
content-encoding: gzip 
content-length: 350 
content-type: application/json; charset=UTF-8 
date: Sun, 20 Sep 2015 05:15:54 GMT 
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/ih1aNGvKXcChCR4os4iGDwWDjmQ" 
expires: Sun, 20 Sep 2015 05:15:54 GMT 
server: GSE 
vary: Origin, X-Origin 
{ 
"kind": "youtube#channelListResponse", 
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/ih1aNGvKXcChCR4os4iGDwWDjmQ\"", 
"pageInfo": { 
    "totalResults": 1, 
    "resultsPerPage": 5 
}, 
"items": [ 
    { 

    "kind": "youtube#channel", 
    "etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/vDeq-1ACEYq89nbPsEZtYt0KNW0\"", 
    "id": "UC29ju8bIPH5as8OGnQzwJyA", 
    "contentDetails": { 
    "relatedPlaylists": { 
    "likes": "LL29ju8bIPH5as8OGnQzwJyA", 
    "favorites": "FL29ju8bIPH5as8OGnQzwJyA", 
    "uploads": "UU29ju8bIPH5as8OGnQzwJyA" 
    }, 
    "googlePlusUserId": "111890735795696959293" 
    } 
    } 
] 
} 

用於他的成績請求:

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=techguyweb 

我激活使用OAuth 2.0,所以我不知道是什麼問題的授權。

編輯

註釋說,因爲這是我的YouTube用戶名,而不是我的谷歌加上帳戶名稱。我忘了把它也提供給我們。這是相同的結果。

200 OK 
- HIDE HEADERS - 
cache-control: private, max-age=0, must-revalidate, no-transform 
content-encoding: gzip 
content-length: 184 
content-type: application/json; charset=UTF-8 
date: Sun, 20 Sep 2015 14:10:14 GMT 
etag: "jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4" 
expires: Sun, 20 Sep 2015 14:10:14 GMT 
server: GSE 
vary: Origin, X-Origin 
{ 
"kind": "youtube#channelListResponse", 
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/Z9n3n2b5RwRnE9WNo9TXpCBWbY4\"", 
"pageInfo": { 
    "totalResults": 0, 
    "resultsPerPage": 5 
}, 
"items": [ 
] 
} 
+0

因爲這是您的YouTube用戶名,而不是您的Google +帳戶名。沒什麼奇怪的 – mpgn

回答

0

它的回報,如果你指定通道ID,而不是頻道名稱(我通過HTTP請求中的信息,但它應該爲你工作正在試圖獲得響應的方式相同),正確的響應。

{ 
"kind": "youtube#channelListResponse", 
"etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/pZlhvAUywQ74J9YlQvQ1UqIqanc\"", 
"pageInfo": { 
    "totalResults": 1, 
    "resultsPerPage": 1 
}, 
"items": [ 
    { 
    "kind": "youtube#channel", 
    "etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/iPoXCMXPqVZgATwZUSDCg0QqeCM\"", 
    "id": "UCoyAhNWQms1nSgGbI3rVebQ", 
    "snippet": { 
    "title": "StraconisChannel", 
    "description": "", 
    "publishedAt": "2015-09-08T22:33:23.000Z", 
    "thumbnails": { 
    "default": { 
     "url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s88-c-k-no/photo.jpg" 
    }, 
    "medium": { 
     "url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s240-c-k-no/photo.jpg" 
    }, 
    "high": { 
     "url": "https://yt3.ggpht.com/-Yyqu34zJ9zs/AAAAAAAAAAI/AAAAAAAAAAA/tjDa1pW2Smw/s240-c-k-no/photo.jpg" 
    } 
    }, 
    "localized": { 
    "title": "StraconisChannel", 
    "description": "" 
    }, 
    "country": "US" 
    }, 
    "contentDetails": { 
    "relatedPlaylists": { 
    "uploads": "UUoyAhNWQms1nSgGbI3rVebQ" 
    }, 
    "googlePlusUserId": "108236998864115482919" 
    } 
    } 
] 
} 

確保您已驗證您的YouTube頻道並將您的頻道關聯到Google+信息頁或個人資料。