]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/streetvoice.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..compat 
import compat_str
 
   6 from ..utils 
import unified_strdate
 
   9 class StreetVoiceIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:.+?\.)?streetvoice\.com/[^/]+/songs/(?P<id>[0-9]+)' 
  12         'url': 'http://streetvoice.com/skippylu/songs/94440/', 
  13         'md5': '15974627fc01a29e492c98593c2fd472', 
  19             'description': 'Crispy脆樂團 - 輸', 
  20             'thumbnail': 're:^https?://.*\.jpg$', 
  22             'upload_date': '20091018', 
  23             'uploader': 'Crispy脆樂團', 
  24             'uploader_id': '627810', 
  27         'url': 'http://tw.streetvoice.com/skippylu/songs/94440/', 
  28         'only_matching': True, 
  31     def _real_extract(self
, url
): 
  32         song_id 
= self
._match
_id
(url
) 
  34         song 
= self
._download
_json
( 
  35             'http://streetvoice.com/music/api/song/%s' % song_id
, song_id
) 
  38         author 
= song
['musician']['name'] 
  43             'filesize': song
.get('size'), 
  45             'description': '%s - %s' % (author
, title
), 
  46             'thumbnail': self
._proto
_relative
_url
(song
.get('image'), 'http:'), 
  47             'duration': song
.get('length'), 
  48             'upload_date': unified_strdate(song
.get('created_at')), 
  50             'uploader_id': compat_str(song
['musician']['id']),