]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/planetaplay.py
06505e96fb9ac81224f03f71299eb80238c0921f
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import ExtractorError
10 class PlanetaPlayIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?planetaplay\.com/\?sng=(?P<id>[0-9]+)'
12 _API_URL
= 'http://planetaplay.com/action/playlist/?sng={0:}'
13 _THUMBNAIL_URL
= 'http://planetaplay.com/img/thumb/{thumb:}'
15 'url': 'http://planetaplay.com/?sng=3586',
16 'md5': '9d569dceb7251a4e01355d5aea60f9db',
20 'title': 'md5:e829428ee28b1deed00de90de49d1da1',
22 'skip': 'Not accessible from Travis CI server',
26 'lq': (0, 'http://www.planetaplay.com/videoplayback/{med_hash:}'),
27 'hq': (1, 'http://www.planetaplay.com/videoplayback/hi/{med_hash:}'),
30 def _real_extract(self
, url
):
31 mobj
= re
.match(self
._VALID
_URL
, url
)
32 video_id
= mobj
.group('id')
34 response
= self
._download
_json
(
35 self
._API
_URL
.format(video_id
), video_id
)['response']
37 data
= response
.get('data')[0]
40 '%s: failed to get the playlist' % self
.IE_NAME
, expected
=True)
42 title
= '{song_artists:} - {sng_name:}'.format(**data
)
43 thumbnail
= self
._THUMBNAIL
_URL
.format(**data
)
46 for format_id
, (quality
, url_template
) in self
._SONG
_FORMATS
.items():
48 'format_id': format_id
,
49 'url': url_template
.format(**data
),
54 self
._sort
_formats
(formats
)
60 'thumbnail': thumbnail
,