]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thesixtyone.py
d8b1fd2813eadc3d17a17a6d46766b3c9c4ea37a
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,
69 def _real_extract(self
, url
):
70 song_id
= self
._match
_id
(url
)
72 webpage
= self
._download
_webpage
(
73 self
._SONG
_URL
_TEMPLATE
.format(song_id
), song_id
)
75 song_data
= self
._parse
_json
(self
._search
_regex
(
76 r
'"%s":\s(\{.*?\})' % song_id
, webpage
, 'song_data'), song_id
)
78 if self
._search
_regex
(r
'(t61\.s3_audio_load\s*=\s*1\.0;)', webpage
, 's3_audio_load marker', default
=None):
79 song_data
['audio_server'] = 's3.amazonaws.com'
81 song_data
['audio_server'] = song_data
['audio_server'] + '.thesixtyone.com'
83 keys
= [self
._DECODE
_MAP
.get(s
, s
) for s
in song_data
['key']]
84 url
= self
._SONG
_FILE
_URL
_TEMPLATE
.format(
85 "".join(reversed(keys
)), **song_data
)
95 'title': '{artist:} - {name:}'.format(**song_data
),
97 'comment_count': song_data
.get('comments_count'),
98 'duration': song_data
.get('play_time'),
99 'like_count': song_data
.get('score'),
100 'thumbnail': self
._THUMBNAIL
_URL
_TEMPLATE
.format(**song_data
),
101 'upload_date': unified_strdate(song_data
.get('publish_date')),