Youtube api not displaying playlist thumbnail for few videos
This is how i am fetching my thumbnail from the response for each record
data.items[i].snippet.thumbnails.high.url
but for some videos i am just getting the default image
https://i.ytimg.com/vi/default.jpg
instead of example
https://i1.ytimg.com/vi/umgK1_5Dcw4/hqdefault.jpg
How do i fix this problem The thumbnail is visible in my youtube channel
I experienced the same thing recently and was pulling my hair out. The issue was that the video in the playlist that wasn't setting the correct thumbnail was set as Unlisted on YouTube's site. As soon as the video was made Public, the correct thumbnails appeared.
The other issue I ran into was the the entire structure of the thumbnails had different keys if the thumbnail wasn't working.
In a feed where thumbnails were working, we saw this structure:
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/XXXXX/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/XXXXX/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/XXXXX/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/XXXXX/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/XXXXX/maxresdefault.jpg",
"width": 1280,
"height": 720
}
The items that did not have the thumbnails looked like this:
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/default.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/default.jpg"
}
In my code, I was looking for the standard size thumbnail and height & width, which didn't exist in the non working code, which of course caused a null object and crashed the app.
链接地址: http://www.djcxy.com/p/28954.html上一篇: 匿名获取YouTube播放列表视频