summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/ximalaya.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/extractor/ximalaya.py')
-rw-r--r--yt_dlp/extractor/ximalaya.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/yt_dlp/extractor/ximalaya.py b/yt_dlp/extractor/ximalaya.py
index c98c8a4..e900a4a 100644
--- a/yt_dlp/extractor/ximalaya.py
+++ b/yt_dlp/extractor/ximalaya.py
@@ -22,7 +22,7 @@ class XimalayaIE(XimalayaBaseIE):
'uploader_id': '61425525',
'uploader_url': 'http://www.ximalaya.com/zhubo/61425525/',
'title': '261.唐诗三百首.卷八.送孟浩然之广陵.李白',
- 'description': "contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。",
+ 'description': 'contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。',
'thumbnail': r're:^https?://.*\.jpg',
'thumbnails': [
{
@@ -33,14 +33,14 @@ class XimalayaIE(XimalayaBaseIE):
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
- 'height': 180
- }
+ 'height': 180,
+ },
],
'categories': ['其他'],
'duration': 93,
'view_count': int,
'like_count': int,
- }
+ },
},
{
'url': 'http://m.ximalaya.com/61425525/sound/47740352/',
@@ -51,7 +51,7 @@ class XimalayaIE(XimalayaBaseIE):
'uploader_id': '61425525',
'uploader_url': 'http://www.ximalaya.com/zhubo/61425525/',
'title': '261.唐诗三百首.卷八.送孟浩然之广陵.李白',
- 'description': "contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。",
+ 'description': 'contains:《送孟浩然之广陵》\n作者:李白\n故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。',
'thumbnail': r're:^https?://.*\.jpg',
'thumbnails': [
{
@@ -62,35 +62,35 @@ class XimalayaIE(XimalayaBaseIE):
'name': 'cover_url_142',
'url': r're:^https?://.*\.jpg',
'width': 180,
- 'height': 180
- }
+ 'height': 180,
+ },
],
'categories': ['人文'],
'duration': 93,
'view_count': int,
'like_count': int,
- }
- }
+ },
+ },
]
def _real_extract(self, url):
scheme = 'https' if url.startswith('https') else 'http'
audio_id = self._match_id(url)
- audio_info_file = '%s://m.ximalaya.com/tracks/%s.json' % (scheme, audio_id)
- audio_info = self._download_json(audio_info_file, audio_id,
- 'Downloading info json %s' % audio_info_file,
- 'Unable to download info file')
+ audio_info_file = f'{scheme}://m.ximalaya.com/tracks/{audio_id}.json'
+ audio_info = self._download_json(
+ audio_info_file, audio_id,
+ f'Downloading info json {audio_info_file}', 'Unable to download info file')
formats = [{
'format_id': f'{bps}k',
'url': audio_info[k],
'abr': bps,
- 'vcodec': 'none'
+ 'vcodec': 'none',
} for bps, k in ((24, 'play_path_32'), (64, 'play_path_64')) if audio_info.get(k)]
thumbnails = []
- for k in audio_info.keys():
+ for k in audio_info:
# cover pics kyes like: cover_url', 'cover_url_142'
if k.startswith('cover_url'):
thumbnail = {'name': k, 'url': audio_info[k]}