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 json in paython #11112

Closed
ghost opened this issue Nov 3, 2016 · 6 comments
Closed

How to get json in paython #11112

ghost opened this issue Nov 3, 2016 · 6 comments

Comments

@ghost
Copy link

@ghost ghost commented Nov 3, 2016

I use bellow code but not get in json formate in paython like bellow command
youtube-dl -j url


ydl_opts = {
'dumpjson': True,
}

ydl = YoutubeDL(ydl_opts)
info = ydl.extract_info(url, download=False)


Why ydl_opts dumpjson not working?

Please help me if and mistek in code then please give me correct code of python.
Thanks in advance.
I use latest youtube-dl version with django..

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Nov 3, 2016

There is no such option dumpjson. Moreover you don't need any option if you get it as return value of extract_info that works fine.

@dstftw dstftw closed this Nov 3, 2016
@ghost
Copy link
Author

@ghost ghost commented Nov 4, 2016

Is extract_info return all avalible formate or only one?
If posible get all avalible formate then how to get all avalible formate?
May be my code return only one formate.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 4, 2016

Is extract_info return all avalible formate or only one?

all

@ghost
Copy link
Author

@ghost ghost commented Nov 4, 2016

Okay thanks so much for your help...

@ghost
Copy link
Author

@ghost ghost commented Nov 4, 2016

need some help:
i use django but only get one url when i use bellow code. how to get all url in loop with link?

please help me..

from django.shortcuts import render from django.http import HttpResponse from youtube_dl.version import __version__ from youtube_dl import YoutubeDL def index(request): url = 'https://www.youtube.com/watch?v=pvAsqPbz9Ro' ydl = YoutubeDL() info = ydl.extract_info(url, download=False) vurl = info['url'] vtitle = info['title'] ext = info['ext'] output = "<a href="+ vurl + "&title="+ vtitle +">Download - "+ ext + "</a>" return HttpResponse(output)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 4, 2016

Check info['formats'] instead of info['url']

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
2 participants
You can’t perform that action at this time.