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

API to get video's information #8987

Closed
johnsmeeth opened this issue Mar 26, 2016 · 2 comments
Closed

API to get video's information #8987

johnsmeeth opened this issue Mar 26, 2016 · 2 comments

Comments

@johnsmeeth
Copy link

@johnsmeeth johnsmeeth commented Mar 26, 2016

I am new to python. I want to get some information of video as title, size, url from my python code? How to? What API can i use? Please.
Many thanks

@sceext2
Copy link
Contributor

@sceext2 sceext2 commented Mar 26, 2016

Try youtube-dl -j

Run youtube-dl with subprocess and get video information from JSON text (stdout).

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 26, 2016

Here's an example:

from __future__ import unicode_literals
import youtube_dl

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    info_dict = ydl.extract_info(
        'http://www.youtube.com/watch?v=BaW_jenozKc', download=False)
    print(info_dict)

See https://github.com/rg3/youtube-dl#embedding-youtube-dl for more information.

@yan12125 yan12125 closed this Mar 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.