Compare commits

...

2 Commits

Author SHA1 Message Date
c-basalt
66442f1ba8 restore url_result for program entries 2023-10-06 16:36:37 -04:00
c-basalt
1a23290fb7
Update yt_dlp/extractor/neteasemusic.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-10-06 16:27:22 -04:00

View File

@ -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}),