2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class ChirbitIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?chirb\.it/(?:(?:wp|pl)/|fb_chirbit_player\.swf\?key=)?(?P<id>[\da-zA-Z]+)'
14 'url': 'http://chirb.it/PrIPv5',
15 'md5': '9847b0dad6ac3e074568bf2cfb197de8',
19 'title': 'Фасадстрой',
25 'url': 'https://chirb.it/fb_chirbit_player.swf?key=PrIPv5',
26 'only_matching': True,
29 def _real_extract(self, url):
30 audio_id = self._match_id(url)
32 webpage = self._download_webpage(
33 'http://chirb.it/%s' % audio_id, audio_id)
35 audio_url = self._search_regex(
36 r'"setFile"\s*,\s*"([^"]+)"', webpage, 'audio url')
38 title = self._search_regex(
39 r'itemprop="name">([^<]+)', webpage, 'title')
40 duration = parse_duration(self._html_search_meta(
41 'duration', webpage, 'duration', fatal=False))
42 view_count = int_or_none(self._search_regex(
43 r'itemprop="playCount"\s*>(\d+)', webpage,
44 'listen count', fatal=False))
45 comment_count = int_or_none(self._search_regex(
46 r'>(\d+) Comments?:', webpage,
47 'comment count', fatal=False))
54 'view_count': view_count,
55 'comment_count': comment_count,
59 class ChirbitProfileIE(InfoExtractor):
60 _VALID_URL = r'https?://(?:www\.)?chirbit.com/(?:rss/)?(?P<id>[^/]+)'
62 'url': 'http://chirbit.com/ScarletBeauty',
64 'id': 'ScarletBeauty',
65 'title': 'Chirbits by ScarletBeauty',
67 'playlist_mincount': 3,
70 def _real_extract(self, url):
71 profile_id = self._match_id(url)
73 rss = self._download_xml(
74 'http://chirbit.com/rss/%s' % profile_id, profile_id)
77 self.url_result(audio_url.text, 'Chirbit')
78 for audio_url in rss.findall('./channel/item/link')]
80 title = rss.find('./channel/title').text
82 return self.playlist_result(entries, profile_id, title)