]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xminus.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
15 class XMinusIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?x-minus\.org/track/(?P<id>[0-9]+)'
18 'url': 'http://x-minus.org/track/4542/%D0%BF%D0%B5%D1%81%D0%B5%D0%BD%D0%BA%D0%B0-%D1%88%D0%BE%D1%84%D0%B5%D1%80%D0%B0.html',
19 'md5': '401a15f2d2dcf6d592cb95528d72a2a8',
23 'title': 'Леонид Агутин-Песенка шофера',
26 'filesize_approx': 5900000,
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 artist
= self
._html
_search
_regex
(
36 r
'minus_track\.artist="(.+?)"', webpage
, 'artist')
37 title
= artist
+ '-' + self
._html
_search
_regex
(
38 r
'minus_track\.title="(.+?)"', webpage
, 'title')
39 duration
= int_or_none(self
._html
_search
_regex
(
40 r
'minus_track\.dur_sec=\'([0-9]*?
)\'',
41 webpage, 'duration
', fatal=False))
42 filesize_approx = parse_filesize(self._html_search_regex(
43 r'<div
class="filesize[^"]*"></div>\s*([0-9.]+\s*[a-zA-Z][bB])',
44 webpage, 'approximate filesize', fatal=False))
45 tbr = int_or_none(self._html_search_regex(
46 r'<div class="quality
[^
"]*"></div
>\s
*([0-9]+)\s
*kbps
',
47 webpage, 'bitrate
', fatal=False))
48 view_count = int_or_none(self._html_search_regex(
49 r'<div
class="quality.*?► ([0-9]+)',
50 webpage, 'view count', fatal=False))
52 enc_token = self._html_search_regex(
53 r'minus_track\.tkn="(.+?
)"', webpage, 'enc_token')
55 c if pos == 3 else compat_chr(compat_ord(c) - 1)
56 for pos, c in enumerate(reversed(enc_token)))
57 video_url = 'http://x-minus.org/dwlf/%s/%s.mp3' % (video_id, token)
64 'filesize_approx': filesize_approx,
66 'view_count': view_count,