mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-25 07:47:55 +01:00
[soundcloud] Simplify string literals
This commit is contained in:
parent
3d87426c2d
commit
83622b6d2f
@ -100,7 +100,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
|
|
||||||
def report_resolve(self, video_id):
|
def report_resolve(self, video_id):
|
||||||
"""Report information extraction."""
|
"""Report information extraction."""
|
||||||
self.to_screen(u'%s: Resolving id' % video_id)
|
self.to_screen('%s: Resolving id' % video_id)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _resolv_url(cls, url):
|
def _resolv_url(cls, url):
|
||||||
@ -146,14 +146,14 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
formats = []
|
formats = []
|
||||||
format_dict = json.loads(stream_json)
|
format_dict = json.loads(stream_json)
|
||||||
for key, stream_url in format_dict.items():
|
for key, stream_url in format_dict.items():
|
||||||
if key.startswith(u'http'):
|
if key.startswith('http'):
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': key,
|
'format_id': key,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'url': stream_url,
|
'url': stream_url,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
})
|
})
|
||||||
elif key.startswith(u'rtmp'):
|
elif key.startswith('rtmp'):
|
||||||
# The url doesn't have an rtmp app, we have to extract the playpath
|
# The url doesn't have an rtmp app, we have to extract the playpath
|
||||||
url, path = stream_url.split('mp3:', 1)
|
url, path = stream_url.split('mp3:', 1)
|
||||||
formats.append({
|
formats.append({
|
||||||
@ -188,7 +188,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
|
|
||||||
track_id = mobj.group('track_id')
|
track_id = mobj.group('track_id')
|
||||||
token = None
|
token = None
|
||||||
@ -226,7 +226,7 @@ class SoundcloudSetIE(SoundcloudIE):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
|
|
||||||
# extract uploader (which is in the url)
|
# extract uploader (which is in the url)
|
||||||
uploader = mobj.group(1)
|
uploader = mobj.group(1)
|
||||||
@ -243,7 +243,7 @@ class SoundcloudSetIE(SoundcloudIE):
|
|||||||
info = json.loads(info_json)
|
info = json.loads(info_json)
|
||||||
if 'errors' in info:
|
if 'errors' in info:
|
||||||
for err in info['errors']:
|
for err in info['errors']:
|
||||||
self._downloader.report_error(u'unable to download video webpage: %s' % compat_str(err['error_message']))
|
self._downloader.report_error('unable to download video webpage: %s' % compat_str(err['error_message']))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.report_extraction(full_title)
|
self.report_extraction(full_title)
|
||||||
|
Loading…
Reference in New Issue
Block a user