1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-17 01:17:54 +01:00

fix netease music (works in china)

https://github.com/JixunMoe/unblock-163 no longer works but http://music.163.com/song/media/outer/url?id={song_id}.mp3 still works in china
This commit is contained in:
hex3c 2019-03-09 11:36:17 +00:00 committed by GitHub
parent 10734553fe
commit c21a7afae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,24 +44,20 @@ class NetEaseMusicBaseIE(InfoExtractor):
song_file_path = '/%s/%s.%s' % ( song_file_path = '/%s/%s.%s' % (
self._encrypt(details['dfsId']), details['dfsId'], details['extension']) self._encrypt(details['dfsId']), details['dfsId'], details['extension'])
# 203.130.59.9, 124.40.233.182, 115.231.74.139, etc is a reverse proxy-like feature # https://github.com/JixunMoe/unblock-163 no longer works but
# from NetEase's CDN provider that can be used if m5.music.126.net does not # http://music.163.com/song/media/outer/url?id={song_id}.mp3 still works in china
# work, especially for users outside of Mainland China
# via: https://github.com/JixunMoe/unblock-163/issues/3#issuecomment-163115880 song_url = 'http://music.163.com/song/media/outer/url?id=' + str(info['id']) + '.mp3'
for host in ('http://m5.music.126.net', 'http://115.231.74.139/m1.music.126.net', if self._is_valid_url(song_url, info['id'], 'song'):
'http://124.40.233.182/m1.music.126.net', 'http://203.130.59.9/m1.music.126.net'): formats.append({
song_url = host + song_file_path 'url': song_url,
if self._is_valid_url(song_url, info['id'], 'song'): 'ext': details.get('extension'),
formats.append({ 'abr': float_or_none(details.get('bitrate'), scale=1000),
'url': song_url, 'format_id': song_format,
'ext': details.get('extension'), 'filesize': details.get('size'),
'abr': float_or_none(details.get('bitrate'), scale=1000), 'asr': details.get('sr')
'format_id': song_format, })
'filesize': details.get('size'), return formats
'asr': details.get('sr')
})
break
return formats
@classmethod @classmethod
def convert_milliseconds(cls, ms): def convert_milliseconds(cls, ms):