Skip to content

Continue trying after _parse_jwplayer_data fails - #16735

Closed
moyamo wants to merge 4 commits into
ytdl-org:masterfrom
moyamo:jwplayer2-fix
Closed

Continue trying after _parse_jwplayer_data fails#16735
moyamo wants to merge 4 commits into
ytdl-org:masterfrom
moyamo:jwplayer2-fix

Conversation

@moyamo

@moyamo moyamo commented Jun 14, 2018

Copy link
Copy Markdown
Contributor

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

This pull request supersedes #12516. Essentially the problem is that _parse_jwplayer_data fails when the "JSON" structure it extracts contains variable references. However it seems an extractor further down in generic.py still works.

This pull requests makes it so that if _parse_jwplayer_data fails instead of giving up youtube-dl continues trying different extractors.

@dstftw dstftw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test.

Comment thread youtube_dl/utils.py Outdated
msg = video_id + ': ' + msg
if cause:
msg += ' (caused by %r)' % cause
self.msg_without_bug_report = msg

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Comment thread youtube_dl/extractor/generic.py Outdated
info = self._parse_jwplayer_data(
jwplayer_data, video_id, require_title=False, base_url=url)
return merge_dicts(info, info_dict)
except ExtractorError, e:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid syntax.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I thought we were using python 2 for some reason.

Comment thread youtube_dl/extractor/generic.py Outdated
jwplayer_data, video_id, require_title=False, base_url=url)
return merge_dicts(info, info_dict)
except ExtractorError, e:
self.to_screen(e.msg_without_bug_report)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Comment thread youtube_dl/extractor/generic.py Outdated
return merge_dicts(info, info_dict)
except ExtractorError, e:
self.to_screen(e.msg_without_bug_report)
self.to_screen("Trying different extractor")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What message should I write here. Should I just pass instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what's wrong with this message. Should I just remove them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback would be appreciated.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be any messages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@moyamo

moyamo commented Jun 16, 2018

Copy link
Copy Markdown
Contributor Author

I added a test.

@dstftw dstftw closed this in 3d08f63 Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants