Compare commits

..

No commits in common. "66442f1ba8f8d5fb6a924937369d16cf4cbae24c" and "dae7a60b805ac2ae50aeeb1d5e7f0110f8babbb5" have entirely different histories.

View File

@ -115,14 +115,12 @@ 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'):
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})))
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)
class NetEaseMusicIE(NetEaseMusicBaseIE):
@ -582,9 +580,7 @@ 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.url_result(
f'http://music.163.com/#/program?id={program["id"]}', NetEaseMusicProgramIE,
program['id'], program.get('name')) for program in info['programs'])
entries.extend(self._get_entries(info, 'programs'))
if not metainfo:
metainfo = traverse_obj(info, ('programs', 0, 'radio', {
'title': ('name', {str}),