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

[ie/zaiko] Add support jwt-protected video urls #10130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pzhlkj6612
Copy link
Contributor

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Credit goes to @vschule (see #9798 (comment)). I wrote this PR based on their informative suggestion.

This PR fixes #9798 .

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • 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?

@pzhlkj6612 pzhlkj6612 marked this pull request as ready for review June 7, 2024 14:13
@bashonly bashonly added the site-bug Issue with a specific website label Jun 7, 2024
Comment on lines +86 to +89
stream_url = self._download_json(traverse_obj(
initial_event_info, ('jwt_token_url', {url_or_none})), video_id,
note='Downloading jwt-protected stream url',
errnote='Failed to download jwt-protected stream url')['playback_url']
Copy link
Member

Choose a reason for hiding this comment

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

don't need the traversal here if it's otherwise fatal

Suggested change
stream_url = self._download_json(traverse_obj(
initial_event_info, ('jwt_token_url', {url_or_none})), video_id,
note='Downloading jwt-protected stream url',
errnote='Failed to download jwt-protected stream url')['playback_url']
stream_url = self._download_json(
initial_event_info['jwt_token_url'], video_id, 'Downloading JWT-protected stream URL',
'Failed to download JWT-protected stream URL')['playback_url']

@@ -66,7 +66,9 @@ def _real_extract(self, url):
stream_meta['stream-access']['video_source'], video_id,
'Downloading player page', headers={'referer': 'https://zaiko.io/'})
player_meta = self._parse_vue_element_attr('player', player_page, video_id)
status = traverse_obj(player_meta, ('initial_event_info', 'status', {str}))
initial_event_info = player_meta['initial_event_info']
Copy link
Member

Choose a reason for hiding this comment

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

The rest of the extractor seemed to be written to be non-fatal all the way down to the expected raise_no_formats call. Will making this line fatal have any ill effect? (I'm just asking a question, not requesting a change here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will making this line fatal have any ill effect?

Well, I didn't check it carefully. Not all information is extracted from the "initial_event_info" object (we also have "player_meta"), so making it fatal is not ideal.

The design of "fatal vs. non-fatal" always confuses me, btw.

@bashonly bashonly added the pending-fixes PR has had changes requested label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-fixes PR has had changes requested site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Zaiko] Unable to extract player
2 participants