1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-01 23:25:14 +00:00

[cleanup] Add more ruff rules (#10149)

Authored by: seproDev

Reviewed-by: bashonly <88596187+bashonly@users.noreply.github.com>
Reviewed-by: Simon Sawicki <contact@grub4k.xyz>
This commit is contained in:
sepro
2024-06-12 01:09:58 +02:00
committed by GitHub
parent db50f19d76
commit add96eb9f8
915 changed files with 7027 additions and 7246 deletions

View File

@@ -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]}