Skip to content

Commit

Permalink
[ie/soundcloud] Various fixes (yt-dlp#11820)
Browse files Browse the repository at this point in the history
- Fix original/download formats so that they are considered bestaudio
- Raise appropriate error if track is DRM-protected

Authored by: bashonly
  • Loading branch information
bashonly authored Dec 15, 2024
1 parent 09a6c68 commit d298693
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions yt_dlp/extractor/soundcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _extract_info_dict(self, info, full_title=None, secret_token=None, extract_f

format_urls = set()
formats = []
has_drm = False
query = {'client_id': self._CLIENT_ID}
if secret_token:
query['secret_token'] = secret_token
Expand Down Expand Up @@ -245,6 +246,7 @@ def _extract_info_dict(self, info, full_title=None, secret_token=None, extract_f
'url': format_url,
'quality': 10,
'format_note': 'Original',
'vcodec': 'none',
})

def invalid_url(url):
Expand All @@ -260,6 +262,7 @@ def invalid_url(url):

protocol = traverse_obj(t, ('format', 'protocol', {str})) or 'http'
if protocol.startswith(('ctr-', 'cbc-')):
has_drm = True
continue
if protocol == 'progressive':
protocol = 'http'
Expand Down Expand Up @@ -317,8 +320,11 @@ def invalid_url(url):
'preference': -10 if is_preview else None,
})

if not formats and info.get('policy') == 'BLOCK':
self.raise_geo_restricted(metadata_available=True)
if not formats:
if has_drm:
self.report_drm(track_id)
if info.get('policy') == 'BLOCK':
self.raise_geo_restricted(metadata_available=True)

user = info.get('user') or {}

Expand Down

0 comments on commit d298693

Please sign in to comment.