Reputation: 880
I used the following code to get title and like count of youtube video:
$gdata_url = 'http://gdata.youtube.com/feeds/api/videos/'.$videoId.'?v=2&alt=jsonc';
$json_content = file_get_contents($gdata_url, 0, null, null);
But currently title of json response always contains https://youtube.com/devicesupport instead of actual title and json response does not contain viewCount.
Could you please advise how to solve the issue?
Upvotes: 2
Views: 795
Reputation: 942
Youtube API v2 has been deprecated. You can find how to get video info with v3 here.
You use the part
parameter to define what properties you want to retrieve. Snippet
gives you most of the properties including title and statistics
returns the like count. You can use "snippet,statistics"
to get both with one call.
Upvotes: 2