mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 03:11:24 +01:00
Compare commits
2 Commits
dae7a60b80
...
66442f1ba8
Author | SHA1 | Date | |
---|---|---|---|
|
66442f1ba8 | ||
|
1a23290fb7 |
|
@ -115,12 +115,14 @@ class NetEaseMusicBaseIE(InfoExtractor):
|
|||
raise ExtractorError(f'Failed to get meta info: {code} {message}')
|
||||
return result
|
||||
|
||||
def _get_entries(self, songs_data, entry_keys=None, id_key='id', name_key='name', ie='NetEaseMusic'):
|
||||
for song in traverse_obj(songs_data, (*variadic(entry_keys, (str, bytes, dict, set)), ...)):
|
||||
song_id = traverse_obj(song, (id_key, {int_or_none}))
|
||||
song_name = traverse_obj(song, (name_key, {str})) if name_key else None
|
||||
if song_id:
|
||||
yield self.url_result(f'http://music.163.com/#/song?id={song_id}', ie, str(song_id), song_name)
|
||||
def _get_entries(self, songs_data, entry_keys=None, id_key='id', name_key='name'):
|
||||
for song in traverse_obj(songs_data, (
|
||||
*variadic(entry_keys, (str, bytes, dict, set)),
|
||||
lambda _, v: int_or_none(v[id_key]) is not None)):
|
||||
song_id = str(song[id_key])
|
||||
yield self.url_result(
|
||||
f'http://music.163.com/#/song?id={song_id}', NetEaseMusicIE,
|
||||
song_id, traverse_obj(song, (name_key, {str})))
|
||||
|
||||
|
||||
class NetEaseMusicIE(NetEaseMusicBaseIE):
|
||||
|
@ -580,7 +582,9 @@ class NetEaseMusicDjRadioIE(NetEaseMusicBaseIE):
|
|||
f'dj/program/byradio?asc=false&limit={self._PAGE_SIZE}&radioId={dj_id}&offset={offset}',
|
||||
dj_id, note=f'Downloading dj programs - {offset}')
|
||||
|
||||
entries.extend(self._get_entries(info, 'programs'))
|
||||
entries.extend(self.url_result(
|
||||
f'http://music.163.com/#/program?id={program["id"]}', NetEaseMusicProgramIE,
|
||||
program['id'], program.get('name')) for program in info['programs'])
|
||||
if not metainfo:
|
||||
metainfo = traverse_obj(info, ('programs', 0, 'radio', {
|
||||
'title': ('name', {str}),
|
||||
|
|
Loading…
Reference in New Issue
Block a user