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

Dumping JSON for playlists returns invalid syntax #6894

Closed
steebchen opened this issue Sep 19, 2015 · 2 comments
Closed

Dumping JSON for playlists returns invalid syntax #6894

steebchen opened this issue Sep 19, 2015 · 2 comments

Comments

@steebchen
Copy link
Contributor

@steebchen steebchen commented Sep 19, 2015

When calling youtube-dl with the --dump-json argument and a playlist, like this:

youtube-dl --dump-json https://www.youtube.com/watch?v=5Fjjgjcvj24&list=PLvMgpveoV8oRvM_kBZULuPn5wlQkUjPth

then it returns invalid json, which looks like that:

{ "upload_date":"20130922", .. } { "upload_date":"20130922", .. } { "upload_date":"20130922", .. } 

I can't JSON.parse() it, because first, there is no comma between each element, and second, it has to be an array, so it should like that:

[{ "upload_date":"20130922", .. }, { "upload_date":"20130922", .. }, { "upload_date":"20130922", .. } ]

Or am I just missing something?
I'm using the latest version on npm.

As a workaround, you have to use --dump-single-json or -J to get a correct result.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 19, 2015

How about:

string_from_youtube_dl.split('\n').map(JSON.parse)

Given you're using Javascript.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 19, 2015

This is expected behavior. --dump-json outputs JSON for each video separately.

@dstftw dstftw closed this Sep 19, 2015
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.