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

[extractor/tele5] Modified tele5 extractor to fix Issue #8501 #9792

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

Conversation

JerryZhouSirui
Copy link

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:

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

Copy link
Member

@pukkandan pukkandan left a 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

Comment on lines +46 to +52
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.')
Copy link
Member

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

Comment on lines +54 to 63
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'] + ')'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

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

?

Comment on lines 83 to +89
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
}
Copy link
Member

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
Copy link
Member

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>[^/?#&]+)')
Copy link
Member

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')
Copy link
Member

Choose a reason for hiding this comment

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

traverse_obj

@pukkandan pukkandan added site-bug Issue with a specific website pending-fixes PR has had changes requested labels Apr 26, 2024
@pukkandan
Copy link
Member

pukkandan commented Apr 26, 2024

This is just a copy of #8501 with unrelated beatport changes added on top??? Pls explain

Ignore above review until this is resolved

@pukkandan pukkandan added the invalid This doesn't seem right label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right 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.

None yet

2 participants