]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xminus.py
8c6241aedf7249343a725ab705968d0af963294a
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
17 class XMinusIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?x-minus\.org/track/(?P<id>[0-9]+)'
20 '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',
21 'md5': '401a15f2d2dcf6d592cb95528d72a2a8',
25 'title': 'Леонид Агутин-Песенка шофера',
28 'filesize_approx': 5900000,
30 'description': 'md5:03238c5b663810bc79cf42ef3c03e371',
34 def _real_extract(self
, url
):
35 video_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, video_id
)
38 artist
= self
._html
_search
_regex
(
39 r
'minus_track\.artist="(.+?)"', webpage
, 'artist')
40 title
= artist
+ '-' + self
._html
_search
_regex
(
41 r
'minus_track\.title="(.+?)"', webpage
, 'title')
42 duration
= int_or_none(self
._html
_search
_regex
(
43 r
'minus_track\.dur_sec=\'([0-9]*?
)\'',
44 webpage, 'duration
', fatal=False))
45 filesize_approx = parse_filesize(self._html_search_regex(
46 r'<div
class="filesize[^"]*"></div>\s*([0-9.]+\s*[a-zA-Z][bB])',
47 webpage, 'approximate filesize', fatal=False))
48 tbr = int_or_none(self._html_search_regex(
49 r'<div class="quality
[^
"]*"></div
>\s
*([0-9]+)\s
*kbps
',
50 webpage, 'bitrate
', fatal=False))
51 view_count = int_or_none(self._html_search_regex(
52 r'<div
class="quality.*?► ([0-9]+)',
53 webpage, 'view count', fatal=False))
54 description = self._html_search_regex(
55 r'(?s)<div id="song_texts
">(.*?)</div><br',
56 webpage, 'song lyrics', fatal=False)
58 description = re.sub(' *\r *', '\n', description)
60 enc_token = self._html_search_regex(
61 r'minus_track\.tkn="(.+?
)"', webpage, 'enc_token')
63 c if pos == 3 else compat_chr(compat_ord(c) - 1)
64 for pos, c in enumerate(reversed(enc_token)))
65 video_url = 'http://x-minus.org/dwlf/%s/%s.mp3' % (video_id, token)
72 'filesize_approx': filesize_approx,
74 'view_count': view_count,
75 'description': description,