]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Add new extractor for TV Noe (Czech Christian TV).
authorMatěj Cepl <mcepl@cepl.eu>
Thu, 1 Sep 2016 15:31:08 +0000 (17:31 +0200)
committerMatěj Cepl <mcepl@cepl.eu>
Sun, 4 Sep 2016 17:06:40 +0000 (19:06 +0200)
Fixes #10520

youtube_dl/extractor/extractors.py
youtube_dl/extractor/tvnoe.py [new file with mode: 0644]

index 8c6ee0503a91d74e26896da31827bdd06f324b07..e47adc26ce1f6af014cb0a3da21b6e9908ebcbb2 100644 (file)
@@ -916,6 +916,7 @@ from .tvc import (
 )
 from .tvigle import TvigleIE
 from .tvland import TVLandIE
+from .tvnoe import TVNoeIE
 from .tvp import (
     TVPEmbedIE,
     TVPIE,
diff --git a/youtube_dl/extractor/tvnoe.py b/youtube_dl/extractor/tvnoe.py
new file mode 100644 (file)
index 0000000..d50261d
--- /dev/null
@@ -0,0 +1,44 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .jwplatform import JWPlatformBaseIE
+from ..utils import clean_html, get_element_by_class, js_to_json
+
+
+class TVNoeIE(JWPlatformBaseIE):
+    _VALID_URL = r'https?://(www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)'
+    _TEST = {
+        'url': 'http://www.tvnoe.cz/video/10362',
+        'md5': 'aee983f279aab96ec45ab6e2abb3c2ca',
+        'info_dict': {
+            'id': '10362',
+            'ext': 'mp4',
+            'series': 'Noční univerzita',
+            'title': 'prof. Tomáš Halík, Th.D. - ' +
+                     'Návrat náboženství a střet civilizací',
+            'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        iframe_url = self._search_regex(r'<iframe[^>]+src="([^"]+)"',
+                                        webpage, 'iframe src attribute')
+
+        ifs_page = self._download_webpage(iframe_url, video_id)
+        jwplayer_data = self._parse_json(self._find_jwplayer_data(ifs_page),
+                                         video_id, transform_source=js_to_json)
+        info_dict = self._parse_jwplayer_data(
+            jwplayer_data, video_id, require_title=False, base_url=iframe_url)
+
+        info_dict.update({
+            'id': video_id,
+            'title': clean_html(
+               get_element_by_class('field-name-field-podnazev', webpage)),
+            'description': clean_html(get_element_by_class('field-name-body',
+                                                           webpage)),
+            'series': clean_html(get_element_by_class('title', webpage))
+        })
+        return info_dict