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
[extractor/tele5] Modified tele5 extractor to fix Issue #8501 #9792
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial review b4 I realized the PR is fundamentally broken
try: | ||
playables_json = self._search_regex( | ||
r'window\.Playables\s*=\s*({.+?})\s*;', webpage, | ||
'playables info', default='{}', flags=re.DOTALL) | ||
playables = self._parse_json(playables_json, track_id) | ||
except re.error: | ||
raise ExtractorError('Failed to extract playables information. The page structure may have changed.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might as well convert this to self._search_json
since we are editing it
if not playables or 'tracks' not in playables: | ||
raise ExtractorError('No playable tracks found in the extracted information.') | ||
|
||
title = ', '.join((a['name'] for a in track['artists'])) + ' - ' + track['name'] | ||
if track['mix']: | ||
track = next((t for t in playables['tracks'] if t['id'] == int(track_id)), None) | ||
if not track: | ||
raise ExtractorError(f'No track with ID {track_id} found.') | ||
|
||
title = ', '.join(a['name'] for a in track['artists']) + ' - ' + track['name'] | ||
if track.get('mix'): | ||
title += ' (' + track['mix'] + ')' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not playables or 'tracks' not in playables: | |
raise ExtractorError('No playable tracks found in the extracted information.') | |
title = ', '.join((a['name'] for a in track['artists'])) + ' - ' + track['name'] | |
if track['mix']: | |
track = next((t for t in playables['tracks'] if t['id'] == int(track_id)), None) | |
if not track: | |
raise ExtractorError(f'No track with ID {track_id} found.') | |
title = ', '.join(a['name'] for a in track['artists']) + ' - ' + track['name'] | |
if track.get('mix'): | |
title += ' (' + track['mix'] + ')' | |
track = traverse_obj(playables, ('tracks', lambda _, t: t['id'] == int(track_id), {dict})) | |
if not track: | |
raise ExtractorError(f'No track with ID {track_id} found') | |
title = join_nonempty( | |
', '.join(traverse_obj(track, ('artists', ..., 'name'))), | |
track.get('name'), format_field(track, 'mix', '(%s)')) |
@@ -503,6 +503,7 @@ | |||
- **gem.cbc.ca**: [*cbcgem*](## "netrc machine") | |||
- **gem.cbc.ca:live** | |||
- **gem.cbc.ca:playlist** | |||
- **generic**: Generic downloader that works on some sites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
return { | ||
'id': compat_str(track.get('id')) or track_id, | ||
'display_id': track.get('slug') or display_id, | ||
'id': compat_str(track.get('id', track_id)), | ||
'display_id': track.get('slug', display_id), | ||
'title': title, | ||
'formats': formats, | ||
'thumbnails': images, | ||
} | ||
'thumbnails': images | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
@@ -1,17 +1,68 @@ | |||
import re | |||
|
|||
import requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use requests. All network access should go through the helper functions
if getattr(e, 'message', '') == 'Missing deviceId in context': | ||
self.report_drm(video_id) | ||
raise | ||
content_regex = re.compile(r'https?://(?:www\.)?(?P<environment>[^.]+)\.de/(?P<parent_slug>[^/]+)/(?P<slug>[^/?#&]+)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._search_regex
referer=url, | ||
url='https://de-api.loma-cms.com/feloma/configurations/?environment={0}'.format(environment)) | ||
|
||
site_info = cached_base.get('data').get('settings').get('site') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traverse_obj
This is just a copy of #8501 with unrelated beatport changes added on top??? Pls explain Ignore above review until this is resolved |
IMPORTANT: PRs without the template will be CLOSED
Description of your pull request and other information
ADD DESCRIPTION HERE
Fixes #
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:
What is the purpose of your pull request?