]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thesixtyone.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..utils
import unified_strdate
8 class TheSixtyOneIE(InfoExtractor
):
9 _VALID_URL
= r
'''(?x)https?://(?:www\.)?thesixtyone\.com/
15 )/(?:[^/]+/)?(?P<id>[A-Za-z0-9]+)/?$'''
16 _SONG_URL_TEMPLATE
= 'http://thesixtyone.com/s/{0:}'
17 _SONG_FILE_URL_TEMPLATE
= 'http://{audio_server:}/thesixtyone_production/audio/{0:}_stream'
18 _THUMBNAIL_URL_TEMPLATE
= '{photo_base_url:}_desktop'
21 'url': 'http://www.thesixtyone.com/s/SrE3zD7s1jt/',
22 'md5': '821cc43b0530d3222e3e2b70bb4622ea',
26 'title': 'CASIO - Unicorn War Mixtape',
27 'thumbnail': 're:^https?://.*_desktop$',
28 'upload_date': '20071217',
33 'url': 'http://www.thesixtyone.com/song/comments/list/SrE3zD7s1jt',
34 'only_matching': True,
37 'url': 'http://www.thesixtyone.com/s/ULoiyjuJWli#/s/SrE3zD7s1jt/',
38 'only_matching': True,
41 'url': 'http://www.thesixtyone.com/#/s/SrE3zD7s1jt/',
42 'only_matching': True,
45 'url': 'http://www.thesixtyone.com/song/SrE3zD7s1jt/',
46 'only_matching': True,
49 'url': 'http://www.thesixtyone.com/maryatmidnight/song/StrawberriesandCream/yvWtLp0c4GQ/',
50 'only_matching': True,
73 def _real_extract(self
, url
):
74 song_id
= self
._match
_id
(url
)
76 webpage
= self
._download
_webpage
(
77 self
._SONG
_URL
_TEMPLATE
.format(song_id
), song_id
)
79 song_data
= self
._parse
_json
(self
._search
_regex
(
80 r
'"%s":\s(\{.*?\})' % song_id
, webpage
, 'song_data'), song_id
)
82 if self
._search
_regex
(r
'(t61\.s3_audio_load\s*=\s*1\.0;)', webpage
, 's3_audio_load marker', default
=None):
83 song_data
['audio_server'] = 's3.amazonaws.com'
85 song_data
['audio_server'] = song_data
['audio_server'] + '.thesixtyone.com'
87 keys
= [self
._DECODE
_MAP
.get(s
, s
) for s
in song_data
['key']]
88 url
= self
._SONG
_FILE
_URL
_TEMPLATE
.format(
89 "".join(reversed(keys
)), **song_data
)
99 'title': '{artist:} - {name:}'.format(**song_data
),
101 'comment_count': song_data
.get('comments_count'),
102 'duration': song_data
.get('play_time'),
103 'like_count': song_data
.get('score'),
104 'thumbnail': self
._THUMBNAIL
_URL
_TEMPLATE
.format(**song_data
),
105 'upload_date': unified_strdate(song_data
.get('publish_date')),