YouTube Player API: How to get duration of a loaded/cued video without playing it?

Solution 1 You can use YouTube Data API to access most of the information about the video, including duration: <script type=”text/javascript”> function youtubeFeedCallback(json){ document.write(json[“data”][“duration”] + ” second(s)”); } </script> <script type=”text/javascript” src=”http://gdata.youtube.com/feeds/api/videos/4TSJhIZmL0A?v=2&alt=jsonc&callback=youtubeFeedCallback&prettyprint=true”></script> Demo here When using jQuery you can use $.getJSON() to make things easier. Solution 2 Seems like YouTube JavaScript API v3 allows you … Read more

loading multiple video players with youtube api

Since onYouTubeIframeAPIReady function is supposed to called only once the following approach could be used: initialize and save video player information (ControlId,width,height,VideoId) in array call onYouTubeIframeAPIReady function to create all the video players Example var playerInfoList = [{id:’player’,height:’390′,width:’640′,videoId:’M7lc1UVf-VE’},{id:’player1′,height:’390′,width:’640′,videoId:’M7lc1UVf-VE’}]; function onYouTubeIframeAPIReady() { if(typeof playerInfoList === ‘undefined’) return; for(var i = 0; i < playerInfoList.length;i++) { var … Read more

cURL error 60: SSL certificate prblm: unable to get local issuer certificate [duplicate]

If you are on Windows using Xampp, I am stealing a better answer from here, would be helpful if Google shows you this question first. Download and extract for cacert.pem here (a clean file format/data) https://curl.haxx.se/docs/caextract.html Put it in : C:\xampp\php\extras\ssl\cacert.pem Add this line to your php.ini curl.cainfo = “C:\xampp\php\extras\ssl\cacert.pem” restart your webserver/Apache

Google API to get impressions of youtube videos?

As always YouTube APIs doesn’t provide access to a basic feature but here is a workaround: The following answer is similar to the one I wrote about retrieving Unique viewers from the Audience tab. Go on your Video analytics interface in YouTube Studio. Open the Web Developer Tools Network tab of your web-browser (by using … Read more

How to bypass entering authentication code to authorize my code everytime I use the YouTube Data API v3

Indeed there’s the possibility to save your credentials object the first time running successfully an OAuth authorization/authentication flow; then to load the credentials object from that file each time running the program for the n-th time, where n >= 2. Here is how I recommend to structure your code: import os, pickle from google_auth_oauthlib.flow import … Read more

how to map youtube handles to channel IDs

One more time YouTube Data API v3 doesn’t provide a basic feature. I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?handle=@HANDLE you will get the YouTube channel id you are looking for in item[“id”]. For instance with the YouTube channel handle @WHO, you would get: { “kind”: “youtube#channelListResponse”, “etag”: … Read more