Youku open API: Youku
Youku open API: http://v.youku.com/player/getplaylist/videoids/video ID
For example, in the browser address bar, enter the video ID XNjI0NDMxNDc2.
Http://v.youku.com/player/getPlayList/VideoIDS/XNjI0NDMxNDc2
The returned result data in json format is as follows (partial, incomplete ):
VidEncoded is the encoded video ID. In this example, XNjI0NDMxNDc2 is used;
The logo is a video, the title is the video title, the tags is the video tag, and the seconds is the video duration.
The implementation of this case is as follows:
1. enter the URL of a video, bind a click event to the search button, and call ajax;
2. transmit the video url to the backend using ajax, parse the video id in the url through the regular expression in the PHP background, and call the open API using curl to obtain the returned json data;
3. splice the json data returned from the background into the video playback code and display it in the corresponding div.
?
Code implementation:
Front-end code youku. php: