2013-04-26 49 views
6

Tôi muốn truy xuất các thẻ cho một video cụ thể trên YouTube bằng cách sử dụng v3 của API YouTube.Cách truy xuất thẻ video của YouTube bằng API YouTube v3?

Tôi có thể truy xuất video có yêu cầu này tới điểm cuối tìm kiếm, https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=cats&type=video&key= {YOUR_API_KEY}.

Bây giờ tôi đã nhấn điểm cuối video cố gắng lấy thẻ cho video từ truy vấn trên. https://www.googleapis.com/youtube/v3/videos?id=IytNBm8WA1c&part=snippet&key= {} YOUR_API_KEY

Response,

{ 
"kind": "youtube#videoListResponse", 
"etag": "\"PMn2rAVTRiZHkX45qiqfcLZoTXM/rYBuk4KeZFmSMoiSuaXfy6-Pm28\"", 
"items": [ 
    { 

    "id": "IytNBm8WA1c", 
    "kind": "youtube#video", 
    "etag": "\"PMn2rAVTRiZHkX45qiqfcLZoTXM/_6K6Qz8rLYf0d5gUnucV1LwbwU4\"", 
    "snippet": { 
    "publishedAt": "2007-07-09T14:02:03.000Z", 
    "channelId": "UCFMV3DqmnaRc4oNGvi-3OvQ", 
    "title": "Funny Cats", 
    "description": "it's soo funny :D\r\n\r\naudio content is licensed by UMG\r\n\r\nSong 1: Gioachino Rossini - The Thieving Magpie 0:00 - 1:37\r\nSong 2: The Presidents of the United States of America - Kitty 1:38 - 2:47\r\nSong 3: The Nutcracker 2:48 - 3:51\r\nSong 4: Smash Mouth - All Star 3:51 - 7:06\r\nSong 5: The Wiseguys - Ooh La La 7:07 - 7:43\r\n\r\nPS: i will ignore messages with the subject\r\n\"Business Proposal Regarding Your YouTube Videos\"", 
    "thumbnails": { 
    "default": { 
     "url": "https://i.ytimg.com/vi/IytNBm8WA1c/default.jpg" 
    }, 
    "medium": { 
     "url": "https://i.ytimg.com/vi/IytNBm8WA1c/mqdefault.jpg" 
    }, 
    "high": { 
     "url": "https://i.ytimg.com/vi/IytNBm8WA1c/hqdefault.jpg" 
    } 
    }, 
    "channelTitle": "nguoap", 
    "categoryId": "15" 
    } 
    } 
] 
} 

API Explorer cho yêu cầu này - https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?id=IytNBm8WA1c&part=snippet&_h=3&

Thậm chí nếu tôi cho phép yêu cầu này tôi nhận được kết quả tương tự. Mặc dù, nếu tài khoản được ủy quyền sở hữu video, nó trả về các thẻ.

Tôi làm cách nào để có được thẻ cho video mà tôi sở hữu mà không yêu cầu người dùng cuối ủy quyền tài khoản của họ? Triển khai này là phía máy khách với JS.

UPDATE: GData Issue Link: https://code.google.com/p/gdata-issues/issues/detail?id=4513

Trả lời

13

Theo https://developers.google.com/youtube/v3/docs/videos/list có vẻ như phiên bản mới nhất của API YouTube hiện nay trả thẻ:

https://www.googleapis.com/youtube/v3/videos?key={API-key}&fields=items(snippet(title,description,tags))&part=snippet&id={video_id} 
+0

Muộn còn hơn không! Cảm ơn câu trả lời! – KRB

+0

Cảm ơn. Công trình của nó. –

1

Thật không may, hiện nay bạn có thể chỉ nhận được video với thẻ khi bạn xác nhận bản thân là chủ sở hữu của kênh. Tìm kiếm các thẻ được sử dụng để hoạt động, nhưng is broken trong quá trình triển khai V2 hiện tại.

Các vấn đề liên quan