1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[streetvoice] Fix extraction

The old API results in URLs with HTTP 403 from time to time.

Hopefully fixes #9219.
This commit is contained in:
Yen Chi Hsuan 2016-04-21 13:07:53 +08:00
parent 2c0d9c6217
commit 4dccea8ad0
No known key found for this signature in database
GPG key ID: 3FDDD575826C5C30

View file

@ -14,7 +14,6 @@ class StreetVoiceIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '94440', 'id': '94440',
'ext': 'mp3', 'ext': 'mp3',
'filesize': 4167053,
'title': '', 'title': '',
'description': 'Crispy脆樂團 - 輸', 'description': 'Crispy脆樂團 - 輸',
'thumbnail': 're:^https?://.*\.jpg$', 'thumbnail': 're:^https?://.*\.jpg$',
@ -32,20 +31,19 @@ class StreetVoiceIE(InfoExtractor):
song_id = self._match_id(url) song_id = self._match_id(url)
song = self._download_json( song = self._download_json(
'http://streetvoice.com/music/api/song/%s' % song_id, song_id) 'https://streetvoice.com/api/v1/public/song/%s/' % song_id, song_id, data=b'')
title = song['name'] title = song['name']
author = song['musician']['name'] author = song['user']['nickname']
return { return {
'id': song_id, 'id': song_id,
'url': song['file'], 'url': song['file'],
'filesize': song.get('size'),
'title': title, 'title': title,
'description': '%s - %s' % (author, title), 'description': '%s - %s' % (author, title),
'thumbnail': self._proto_relative_url(song.get('image'), 'http:'), 'thumbnail': self._proto_relative_url(song.get('image'), 'http:'),
'duration': song.get('length'), 'duration': song.get('length'),
'upload_date': unified_strdate(song.get('created_at')), 'upload_date': unified_strdate(song.get('created_at')),
'uploader': author, 'uploader': author,
'uploader_id': compat_str(song['musician']['id']), 'uploader_id': compat_str(song['user']['id']),
} }