2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import clean_html
10 class ChirbitIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?chirb\.it/(?P<id>[^/]+)'
13 'url': 'http://chirb.it/PrIPv5',
14 'md5': '9847b0dad6ac3e074568bf2cfb197de8',
17 'display_id': 'kukushtv_1423231243',
19 'title': 'Фасадстрой',
20 'url': 'http://audio.chirbit.com/kukushtv_1423231243.mp3'
24 def _real_extract(self, url):
25 audio_linkid = self._match_id(url)
26 webpage = self._download_webpage(url, audio_linkid)
28 audio_title = self._html_search_regex(r'<h2\s+itemprop="name">(.*?)</h2>', webpage, 'title')
29 audio_id = self._html_search_regex(r'\("setFile",\s+"http://audio.chirbit.com/(.*?).mp3"\)', webpage, 'audio ID')
30 audio_url = 'http://audio.chirbit.com/' + audio_id + '.mp3';
34 'display_id': audio_id,
39 class ChirbitProfileIE(InfoExtractor):
40 _VALID_URL = r'https?://(?:www\.)?chirbit.com/(?P<id>[^/]+)'
42 'url': 'http://chirbit.com/ScarletBeauty',
46 'title': 'ScarletBeauty',
51 def _real_extract(self, url):
52 profile_id = self._match_id(url)
54 # Chirbit has a pretty weird "Last Page" navigation behavior.
55 # We grab the profile's oldest entry to determine when to
56 # stop fetching entries.
57 oldestpage = self._download_webpage(url + '/24599', profile_id)
58 oldest_page_entries = re.findall(
59 r'''soundFile:\s*"http://audio.chirbit.com/(.*?).mp3"''',
61 oldestentry = clean_html(oldest_page_entries[-1]);
67 page = self._download_webpage(url + '/' + str(n), profile_id)
68 page_ids = re.findall(
69 r'''soundFile:\s*"http://audio.chirbit.com/(.*?).mp3"''',
71 page_titles = re.findall(
72 r'''<div\s+class="chirbit_title"\s*>(.*?)</div>''',
76 if oldestentry in page_ids:
86 'url': 'http://audio.chirbit.com/' + id + '.mp3'