Priyanka Mokashi
Priyanka Mokashi

Reputation: 417

Get Youtube video information by its URL

I have a URL of some you tube video and I want to find out views, likes and dislikes of that video by using google you tube java API. I am using maven dependencies of you tube API as follows:

<!-- YouTube API -->
<dependency>
        <groupId>com.google.apis</groupId>
        <artifactId>google-api-services-youtube</artifactId>
        <version>v3-rev178-1.22.0</version>
</dependency>

As of now my project requirement is only this much and because of time constraint I am not able to read whole google API doc. So can you please help me out to find you tube video information if I have URL with me of that video. Thanks in advance!!!

Upvotes: 0

Views: 818

Answers (1)

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

I was able to get the video statistics by using Videos.list and specified statistics in the part parameter.

enter image description here

The generated URI request was:

https://www.googleapis.com/youtube/v3/videos?part=statistics&id={VIDEO_ID}=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CprevPageToken%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

For that to work you should have a valid API key where Youtube APIs are enabled in Google Dev Console and I think you should be logged-in in your Google account as well.

Upvotes: 2

Related Questions