Using Youtube Data API V3 to get videos of a channel
-
Hello All,
Im trying to get a list of videos from a channel using this API:
Does anybody know how i can import this and parse this in javascript?
Thanks
xCausxnP.S im building a html5 phone application using Intel XDK. If there are any other methods please let me know
-
Might not work with default browser JS due to the Cross Domain Policy.
jQuery.ajax has a crossDomain setting though, you can try and play with that.
-
don't know if you've seen this but they've got a sample lib to call the youtube API... feels a little overcomplicated though
-
@xcausxn The API endpoint example you posted also supports JSONP!
Note the
&callback=foobar
I added. Now if you inject it into a script tag at the top of the page...var scriptEl = document.createElement('script'); scriptEl.src = 'https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCv7IjJclSgpfGUHnG171ovw&order=date&key=AIzaSyBpu8hgnXbkqFVWrAvwRUEz7T13ii3I7WM&callback=foobar'; document.head.appendChild(scriptEl);
... then it will call a the "foobar" function on the page, if available
I miss vanilla JS