php - Get IDs last 3 videos from YouTube Playlist -
i used on api url file_get_contents function , parse_str can array of videos. went wrong here , have no idea how last 3 youtube video's id playlist. here's code , print_r of array
$content = file_get_contents("https://www.googleapis.com/youtube/v3/playlistitems?part=snippet%2ccontentdetails&maxresults=3&key=mykey&playlistid=uucq4lex7rwiwq7vcdwgx-kq"); parse_str($content, $arr); here goes print_r: array ( [0] => array ( [ { "kind": "youtube#playlistitem", "etag": "\"m2yskbqfythfe4irbtieogyyfbu/vriftx84xxno8ak7hmedknbvjgi\"", "id": "vvvjctrsrvg3uldjv1e3vmned0d4lwtrlly5zkronfvvvjfr", "snippet": { "publishedat": "2015-06-23t21:55:22.000z", "channelid": "uccq4lex7rwiwq7vcdwgx-kq", "title": "battleground 2015 live hd na beat-down.pl !", "description": "http://beat-down.pl", "thumbnails": { "default": { "url": ".", "width": 120, "height": 90 }, "medium": { "url": ".", "width": 320, "height": 180 }, "high": { "url": ".", "width": 480, "height": 360 }, "standard": { "url": ".", "width": 640, "height": 480 }, "maxres": { "url": ".", "width": 1280, "height": 720 } }, "channeltitle": "akio", "playlistid": "uucq4lex7rwiwq7vcdwgx-kq", "position": 0, "resourceid": { "kind": "youtube#video", "videoid": "v9fdn4uov1q" } }, "contentdetails": { "videoid": "v9fdn4uov1q", "videopublishedat": "2015-06-23t21:55:22.000z" } }, { "kind": "youtube#playlistitem", "etag": "\"m2yskbqfythfe4irbtieogyyfbu/djdxr8cmoiml16zq7tw1bvs-e4g\"", "id": "vvvjctrsrvg3uldjv1e3vmned0d4lwtrlmu3yw1ob0lktxi0", "snippet": { "publishedat": "2015-06-14t16:08:03.000z", "channelid": "uccq4lex7rwiwq7vcdwgx-kq", "title": "money in bank 2015 w hd za darmo na beat-down.pl", "description": "zaczynamy o 1:00!\nhttp://beat-down.pl", "thumbnails": { "default": { "url": ".", "width": 120, "height": 90 }, "medium": { "url": ".", "width": 320, "height": 180 }, "high": { "url": ".", "width": 480, "height": 360 }, "standard": { "url": ".", "width": 640, "height": 480 }, "maxres": { "url": ".", "width": 1280, "height": 720 } }, "channeltitle": "akio", "playlistid": "uucq4lex7rwiwq7vcdwgx-kq", "position": 1, "resourceid": { "kind": "youtube#video", "videoid": "e7amnoijmr4" } }, "contentdetails": { "videoid": "e7amnoijmr4", "videopublishedat": "2015-06-14t16:08:03.000z" } }, { "kind": "youtube#playlistitem", "etag": "\"m2yskbqfythfe4irbtieogyyfbu/foitrvthww68yv0ur8xvbemx7oo\"", "id": "vvvjctrsrvg3uldjv1e3vmned0d4lwtrlkjumhb3mgtjvgln", "snippet": { "publishedat": "2014-07-21t10:21:45.000z", "channelid": "uccq4lex7rwiwq7vcdwgx-kq", "title": "summerslam 2014 live na beat-down.pl", "description": "17 sierpnia, 2014\nhttp://beat-down.pl", "thumbnails": { "default": { "url": ".", "width": 120, "height": 90 }, "medium": { "url": ".", "width": 320, "height": 180 }, "high": { "url": ".", "width": 480, "height": 360 }, "standard": { "url": ".", "width": 640, "height": 480 }, "maxres": { "url": ".", "width": 1280, "height": 720 } }, "channeltitle": "akio", "playlistid": "uucq4lex7rwiwq7vcdwgx-kq", "position": 2, "resourceid": { "kind": "youtube#video", "videoid": "bt0pw0kitig" } }, "contentdetails": { "videoid": "bt0pw0kitig", "videopublishedat": "2014-07-21t10:21:45.000z" } } ] => ) ) i need in php , can't see goes wrong here.
Comments
Post a Comment