Someone
Someone

Reputation: 438

Youtube API get video length and views

Is this possible? Using Youtube API v3.0 to get video length and views? I can't seem to find anything on it as all the results are for v2.0.

Upvotes: 1

Views: 3023

Answers (1)

jlmcdonald
jlmcdonald

Reputation: 13667

The search endpoint doesn't have a way to return this info yet, but the videos endpoint can if you request the contentDetailsand the statistics in the part parameter ... something like this:

https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2Cstatistics&id=voNEBqRZmBc&key={YOUR_API_KEY}

The returned object will have a duration attribute that's in ISO 8601 format (under the contentDetails), and a views attribute under the statistics.

Upvotes: 3

Related Questions