]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[chirbit] Add new extractor.
authorLeslie P. Polzer <polzer@gnu.org>
Fri, 20 Feb 2015 09:49:45 +0000 (10:49 +0100)
committerLeslie P. Polzer <polzer@gnu.org>
Fri, 20 Feb 2015 09:49:45 +0000 (10:49 +0100)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/chirbit.py [new file with mode: 0644]

index f225ac6546e2f36af6d63e89b0c23d431e9d225c..de08e69bcb9ea658e704b9a803d3b1e6b9c99e86 100644 (file)
@@ -63,6 +63,7 @@ from .ccc import CCCIE
 from .ceskatelevize import CeskaTelevizeIE
 from .channel9 import Channel9IE
 from .chilloutzone import ChilloutzoneIE
+from .chirbit import ChirbitIE
 from .cinchcast import CinchcastIE
 from .clipfish import ClipfishIE
 from .cliphunter import CliphunterIE
diff --git a/youtube_dl/extractor/chirbit.py b/youtube_dl/extractor/chirbit.py
new file mode 100644 (file)
index 0000000..06a3e1a
--- /dev/null
@@ -0,0 +1,34 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ChirbitIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?chirb\.it/(?P<id>[^/]+)'
+    _TEST = {
+        'url': 'http://chirb.it/PrIPv5',
+        'md5': '9847b0dad6ac3e074568bf2cfb197de8',
+        'info_dict': {
+            'id': 'PrIPv5',
+            'display_id': 'kukushtv_1423231243',
+            'ext': 'mp3',
+            'title': 'Фасадстрой',
+            'url': 'http://audio.chirbit.com/kukushtv_1423231243.mp3'
+        }
+    }
+
+    def _real_extract(self, url):
+        audio_linkid = self._match_id(url)
+        webpage = self._download_webpage(url, audio_linkid)
+
+        audio_title = self._html_search_regex(r'<h2\s+itemprop="name">(.*?)</h2>', webpage, 'title')
+        audio_id = self._html_search_regex(r'\("setFile",\s+"http://audio.chirbit.com/(.*?).mp3"\)', webpage, 'audio ID')
+        audio_url = 'http://audio.chirbit.com/' + audio_id + '.mp3';
+
+        return {
+            'id': audio_linkid,
+            'display_id': audio_id,
+            'title': audio_title,
+            'url': audio_url
+        }