4 from .common
import InfoExtractor
14 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,
28 'description': 'md5:03238c5b663810bc79cf42ef3c03e371',
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(url
, video_id
)
36 artist
= self
._html
_search
_regex
(
37 r
'<a[^>]+href="/artist/\d+">([^<]+)</a>', webpage
, 'artist')
38 title
= artist
+ '-' + self
._html
_search
_regex
(
39 r
'<span[^>]+class="minustrack-full-title(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage
, 'title')
40 duration
= parse_duration(self
._html
_search
_regex
(
41 r
'<span[^>]+class="player-duration(?:\s+[^"]+)?"[^>]*>([^<]+)',
42 webpage
, 'duration', fatal
=False))
44 r
'<div[^>]+class="dw-info(?:\s+[^"]+)?"[^>]*>(?P<tbr>\d+)\s*кбит/c\s+(?P<filesize>[0-9.]+)\s*мб</div>',
46 tbr
= filesize_approx
= None
48 filesize_approx
= float(mobj
.group('filesize')) * 1000000
49 tbr
= float(mobj
.group('tbr'))
50 view_count
= int_or_none(self
._html
_search
_regex
(
51 r
'<span><[^>]+class="icon-chart-bar".*?>(\d+)</span>',
52 webpage
, 'view count', fatal
=False))
53 description
= self
._html
_search
_regex
(
54 r
'(?s)<pre[^>]+id="lyrics-original"[^>]*>(.*?)</pre>',
55 webpage
, 'song lyrics', fatal
=False)
57 description
= re
.sub(' *\r *', '\n', description
)
59 k
= self
._search
_regex
(
60 r
'<div[^>]+id="player-bottom"[^>]+data-k="([^"]+)">', webpage
,
62 h
= time
.time() / 3600
63 a
= sum(map(int, [compat_ord(c
) for c
in k
])) + int(video_id
) + h
64 video_url
= 'http://x-minus.me/dl/minus?id=%s&tkn2=%df%d' % (video_id
, a
, h
)
70 # The extension is unknown until actual downloading
73 'filesize_approx': filesize_approx
,
75 'view_count': view_count
,
76 'description': description
,