mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-24 00:05:50 +01:00
[streetvoice] Improve
This commit is contained in:
parent
d63528c8c7
commit
bb0aa4cb3c
@ -2,35 +2,50 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
class StreetVoiceIE(InfoExtractor):
|
class StreetVoiceIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://tw.streetvoice.com/[^/]+/songs/(?P<id>[0-9]+)/'
|
_VALID_URL = r'https?://(?:.+?\.)?streetvoice\.com/[^/]+/songs/(?P<id>[0-9]+)'
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
'url': 'http://streetvoice.com/skippylu/songs/94440/',
|
||||||
'url': 'http://tw.streetvoice.com/skippylu/songs/94440/',
|
'md5': '15974627fc01a29e492c98593c2fd472',
|
||||||
'md5': '15974627fc01a29e492c98593c2fd472',
|
'info_dict': {
|
||||||
'info_dict': {
|
'id': '94440',
|
||||||
'id': '94440',
|
'ext': 'mp3',
|
||||||
'ext': 'mp3',
|
'filesize': 4167053,
|
||||||
'title': '輸',
|
'title': '輸',
|
||||||
'description': '輸 - Crispy脆樂團'
|
'description': 'Crispy脆樂團 - 輸',
|
||||||
}
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'duration': 260,
|
||||||
|
'upload_date': '20091018',
|
||||||
|
'uploader': 'Crispy脆樂團',
|
||||||
|
'uploader_id': '627810',
|
||||||
}
|
}
|
||||||
]
|
}, {
|
||||||
|
'url': 'http://tw.streetvoice.com/skippylu/songs/94440/',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
song_id = self._match_id(url)
|
song_id = self._match_id(url)
|
||||||
|
|
||||||
api_url = 'http://tw.streetvoice.com/music/api/song/%s/' % song_id
|
song = self._download_json(
|
||||||
info_dict = self._download_json(api_url, song_id)
|
'http://streetvoice.com/music/api/song/%s' % song_id, song_id)
|
||||||
|
|
||||||
|
title = song['name']
|
||||||
|
author = song['musician']['name']
|
||||||
|
|
||||||
author = info_dict['musician']['name']
|
|
||||||
title = info_dict['name']
|
|
||||||
return {
|
return {
|
||||||
'id': song_id,
|
'id': song_id,
|
||||||
'ext': 'mp3',
|
'url': song['file'],
|
||||||
|
'filesize': song.get('size'),
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': info_dict['file'],
|
'description': '%s - %s' % (author, title),
|
||||||
'description': '%s - %s' % (title, author)
|
'thumbnail': self._proto_relative_url(song.get('image'), 'http:'),
|
||||||
|
'duration': song.get('length'),
|
||||||
|
'upload_date': unified_strdate(song.get('created_at')),
|
||||||
|
'uploader': author,
|
||||||
|
'uploader_id': compat_str(song['musician']['id']),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user