]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/chirbit.py
b1eeaf101dda3a4a962862fa854db97ae1809329
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class ChirbitIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?chirb\.it/(?:(?:wp|pl)/|fb_chirbit_player\.swf\?key=)?(?P<id>[\da-zA-Z]+)'
15 'url': 'http://chirb.it/PrIPv5',
16 'md5': '9847b0dad6ac3e074568bf2cfb197de8',
20 'title': 'Фасадстрой',
26 'url': 'https://chirb.it/fb_chirbit_player.swf?key=PrIPv5',
27 'only_matching': True,
30 def _real_extract(self
, url
):
31 audio_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(
34 'http://chirb.it/%s' % audio_id
, audio_id
)
36 audio_url
= self
._search
_regex
(
37 r
'"setFile"\s*,\s*"([^"]+)"', webpage
, 'audio url')
39 title
= self
._search
_regex
(
40 r
'itemprop="name">([^<]+)', webpage
, 'title')
41 duration
= parse_duration(self
._html
_search
_meta
(
42 'duration', webpage
, 'duration', fatal
=False))
43 view_count
= int_or_none(self
._search
_regex
(
44 r
'itemprop="playCount"\s*>(\d+)', webpage
,
45 'listen count', fatal
=False))
46 comment_count
= int_or_none(self
._search
_regex
(
47 r
'>(\d+) Comments?:', webpage
,
48 'comment count', fatal
=False))
55 'view_count': view_count
,
56 'comment_count': comment_count
,
60 class ChirbitProfileIE(InfoExtractor
):
61 IE_NAME
= 'chirbit:profile'
62 _VALID_URL
= r
'https?://(?:www\.)?chirbit.com/(?:rss/)?(?P<id>[^/]+)'
64 'url': 'http://chirbit.com/ScarletBeauty',
66 'id': 'ScarletBeauty',
67 'title': 'Chirbits by ScarletBeauty',
69 'playlist_mincount': 3,
72 def _real_extract(self
, url
):
73 profile_id
= self
._match
_id
(url
)
75 rss
= self
._download
_xml
(
76 'http://chirbit.com/rss/%s' % profile_id
, profile_id
)
79 self
.url_result(audio_url
.text
, 'Chirbit')
80 for audio_url
in rss
.findall('./channel/item/link')]
82 title
= rss
.find('./channel/title').text
84 return self
.playlist_result(entries
, profile_id
, title
)