Fetching The Views From Youtube
Is it possible to fetch the youtube views for our video using some queries or request? How can i enhance my viewership on my video by giving views to my video?
Solution 1:
Youtube API V2 is deprecated, so you got to use API V3 https://developers.google.com/youtube/v3/. For using V3 first of all you need to get your application authenticated by the API and get the API key. Once you have that, if you are using PHP you could do something like this
$json = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=statistics&id={YOUR-VIDEO-LINK-ID}&key={YOUR-API-KEY}");
$json_data = json_decode($json, true);
$views = $json_data['items'][0]['statistics']['viewCount'];
echo $views;
Solution 2:
yes it is possible using youtube apis, please refer to the below question : How to get number of video views with YouTube API?
Post a Comment for "Fetching The Views From Youtube"