summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndras Elso <elso.andras@gmail.com>2013-10-14 13:07:47 +0200
committerAndras Elso <elso.andras@gmail.com>2013-10-14 13:07:47 +0200
commitf9b3d7af471909a449c3bf5977a7aaa6555a3495 (patch)
treefcfb109d7c8aed693f171f7f114d043f25b9802b
parentea62a2da466e3fce802930d3685d53a159520719 (diff)
downloadyoutube-dl-f9b3d7af471909a449c3bf5977a7aaa6555a3495.tar.gz
youtube-dl-f9b3d7af471909a449c3bf5977a7aaa6555a3495.tar.xz
youtube-dl-f9b3d7af471909a449c3bf5977a7aaa6555a3495.zip
Add an extractor for Szombathelyi TV
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/sztvhu.py41
2 files changed, 42 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 748f12e5a..14ba6f358 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -112,6 +112,7 @@ from .spiegel import SpiegelIE
 from .stanfordoc import StanfordOpenClassroomIE
 from .statigram import StatigramIE
 from .steam import SteamIE
+from .sztvhu import SztvHuIE
 from .teamcoco import TeamcocoIE
 from .ted import TEDIE
 from .tf1 import TF1IE
diff --git a/youtube_dl/extractor/sztvhu.py b/youtube_dl/extractor/sztvhu.py
new file mode 100644
index 000000000..486f93d26
--- /dev/null
+++ b/youtube_dl/extractor/sztvhu.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from .common import InfoExtractor
+from ..utils import determine_ext
+
+class SztvHuIE(InfoExtractor):
+    _VALID_URL = r'(?:http://)?(?:(?:www\.)?sztv\.hu|www\.tvszombathely\.hu)/([^/]+)/(?P<name>.+)'
+    _TEST = {
+        u'url': u'http://sztv.hu/hirek/cserkeszek-nepszerusitettek-a-kornyezettudatos-eletmodot-a-savaria-teren-20130909',
+        u'file': u'130909zoldnap.mp4',
+        u'md5': u'0047eacedc0afd1ceeac99e69173a07e',
+        u'info_dict': {
+            u"title": u"Cserkészek népszerűsítették a környezettudatos életmódot a Savaria téren",
+            u"description" : u'A zöld nap játékos ismeretterjesztő programjait a Magyar Cserkész Szövetség szervezte, akik az ország nyolc városában adják át tudásukat az érdeklődőknek. A PET...',
+        }
+    }
+
+    def _real_extract(self, url):
+        mobj = re.match(self._VALID_URL, url)
+        name = mobj.group('name')
+        webpage = self._download_webpage(url, name)
+#        file = self._search_regex(r'var fileHtml5 = "...:(.*?)";',
+        file = self._search_regex(r'file: "...:(.*?)",',
+                                webpage, 'video file')
+        title = self._html_search_regex(r'<meta name="title" content="([^"]*)"',
+                                webpage, 'video title').rsplit(' - ', 2)[0]
+        description = self._html_search_regex(r'<meta name="description" content="([^"]*)"/>',
+                                webpage, 'video description')
+        thumbnail = self._og_search_thumbnail(webpage)
+
+        video_url = 'http://media.sztv.hu/vod/' + file
+
+        return {'id': name,
+                'url' : video_url,
+                'title': title,
+                'ext': determine_ext(video_url),
+                'description': description,
+                'thumbnail': thumbnail,
+                }