Fetch YouTube highest thumbnail resolution

前端 未结 4 962
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 20:36

I want to get youtube highest thumbnail \"maxresdefault.jpg\"

Like this one

http://i.ytimg.com/vi/Cj6ho1-G6tw/maxresdefault.jpg

I\'m using this simple ph

4条回答
  •  执念已碎
    2021-02-01 21:00

    The reason is because the resolution on Making the Most of Maps is not at least 720p.

    Looking at the api for this specific video, you can see that there is no maxresdefault.

    Only videos that are 720p or higher in resolution have maxresdefault. This is not listed in the API in videos that are higher. So in order to get the highest resolution, you should also check if the maxresdefault works as well.

    
    
    
    
    
    
    

    Your best bet for the highest quality thumbnail is to use the API and get the image with the largest yt:name attribute.

    The order is:

    default
    mqdefault
    hqdefault
    sddefault
    

    Example code of this in action:

    ';
    

    This works both on $youtub_id = "Cj6ho1-G6tw"; and $youtub_id = "VGazSZUYyf4";.

提交回复
热议问题