Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get information about a video? #17

Closed
kanchansapkota27 opened this issue Mar 23, 2022 · 5 comments
Closed

How to get information about a video? #17

kanchansapkota27 opened this issue Mar 23, 2022 · 5 comments

Comments

@kanchansapkota27
Copy link

Is there a way to get information about a particular video such as likes,comments count or comments itself?

@tombulled
Copy link
Owner

Here's an example that'll print a video's details:

from innertube import InnerTube, Client
from pprint import pprint

video_id = 'zL3wWykAKfs' # Still Woozy - Goodie Bag

ios = InnerTube(Client.IOS)

data = ios.player(video_id=video_id)

pprint(data.videoDetails)

@tombulled
Copy link
Owner

You can get the short view count using next:

from innertube import InnerTube, Client
from pprint import pprint

video_id = 'zL3wWykAKfs' # Still Woozy - Goodie Bag

ios = InnerTube(Client.IOS)

data = ios.next(video_id=video_id)

pprint(data.playerOverlays.playerOverlayRenderer.autoplay.playerOverlayAutoplayRenderer.shortViewCountText)

@tombulled
Copy link
Owner

Each of the different services give data in different places, for example here's the longBylineText for a video using YouTube Music:

from innertube import InnerTube, Client
from pprint import pprint

video_id = 'zL3wWykAKfs' # Still Woozy - Goodie Bag

web_remix = InnerTube(Client.WEB_REMIX)

data = web_remix.music_get_queue(video_ids=[video_id])

pprint(data.queueDatas[0].content.playlistPanelVideoRenderer.longBylineText.runs)

@tombulled
Copy link
Owner

tombulled commented Mar 23, 2022

As for comments, unfortunately I haven't implemented this functionality as this is not a part of the InnerTube API, instead I'd recommend looking into the watch and get_video_info endpoints that YouTube exposes.

Here's some example code I wrote a while back to interact with those endpoints: https://github.com/tombulled/youtube/blob/5bf5dce4b0a9271e507d615fe05384b9d69fb3e9/youtube/operations.py#L36

@kanchansapkota27
Copy link
Author

Thanks I will try these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants