]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[ruv] Add extractor
authorOrn <orngudjonsson@gmail.com>
Thu, 15 Jun 2017 22:29:27 +0000 (22:29 +0000)
committerSergey M․ <dstftw@gmail.com>
Mon, 19 Jun 2017 16:45:45 +0000 (23:45 +0700)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/ruv.py [new file with mode: 0644]

index edbb4bdde7fc02f85b5e7e1a6e784b9a07f76d2d..e97691daa37c5b0c49d0ac501625c12a5b31c03c 100644 (file)
@@ -875,6 +875,7 @@ from .rutube import (
 )
 from .rutv import RUTVIE
 from .ruutu import RuutuIE
+from .ruv import RuvIE
 from .sandia import SandiaIE
 from .safari import (
     SafariIE,
diff --git a/youtube_dl/extractor/ruv.py b/youtube_dl/extractor/ruv.py
new file mode 100644 (file)
index 0000000..518fb50
--- /dev/null
@@ -0,0 +1,31 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class RuvIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?ruv\.is/sarpurinn/ruv/\w+/(?P<id>[0-9]+)'
+    _TEST = {
+        'url': 'http://ruv.is/sarpurinn/ruv/frettir/20170614',
+        'md5': 'a07ea1ebaba64082d90323b1c96f264b',
+        'info_dict': {
+            'id': '20170614',
+            'ext': 'mp4',
+            'title': 'Fréttir',
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        title = self._og_search_title(webpage)
+        video_url = self._html_search_regex(r'video\.src\s*=\s*["\'](.+?)["\']', webpage, 'video URL')
+
+        return {
+            'id': video_id,
+            'title': title,
+            'url': video_url,
+            'ext': 'mp4'
+        }