Get youtube video's title with jQuery using youtube api

前端 未结 4 903
清歌不尽
清歌不尽 2021-02-05 13:26

What is the easiest way to get the title from the youtybe video , for example this video title :

http://www.youtube.com/watch?v=Wp7B81Kx66o

Thanks !

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-05 13:39

    Use jQuery's JSON call to the YouTube API to get the results back and then use jQuery to put the results where you want them. You can use firebug's NET tab to make sure you requests/respoonses are coming back correctly and then use console.log() to make sure you parsed the response correctly.

    eg. URL:

    GET https://gdata.youtube.com/feeds/api/videos/(the-video-id)?v=2&alt=json

    More info:

    YouTube API for a specific video

    Developer's Guide: JSON / JavaScript

提交回复
热议问题