aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-06-12 16:34:28 +0600
committerSergey M․ <dstftw@gmail.com>2015-06-12 16:34:28 +0600
commit5da7177729d6165826e0f3f2bbad06c0e14e37ee (patch)
treeb042e3f41116236a4ac59009ce13209d09325ffe
parent3507766bd0c1e753724ffe23c6d35b903bfc51a0 (diff)
parent99ac0390f559aa6dd09ffd8a15b9b562fda5f363 (diff)
downloadyoutube-dl-5da7177729d6165826e0f3f2bbad06c0e14e37ee.tar.xz
Merge branch '5tv' of https://github.com/hlintala/youtube-dl into hlintala-5tv
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/fivetv.py67
2 files changed, 68 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 18b1c5e54..3bc62e9d5 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -152,6 +152,7 @@ from .fc2 import FC2IE
from .firstpost import FirstpostIE
from .firsttv import FirstTVIE
from .fivemin import FiveMinIE
+from .fivetv import FiveTVIE
from .fktv import (
FKTVIE,
FKTVPosteckeIE,
diff --git a/youtube_dl/extractor/fivetv.py b/youtube_dl/extractor/fivetv.py
new file mode 100644
index 000000000..e47383b39
--- /dev/null
+++ b/youtube_dl/extractor/fivetv.py
@@ -0,0 +1,67 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+)
+
+
+class FiveTVIE(InfoExtractor):
+ _VALID_URL = r'http://(?:www\.)?5-tv\.ru/[^/]*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'http://5-tv.ru/news/96814/',
+ 'md5': 'bbff554ad415ecf5416a2f48c22d9283',
+ 'info_dict': {
+ 'id': '96814',
+ 'ext': 'mp4',
+ 'title': 'Россияне выбрали имя для общенациональной платежной системы',
+ 'description': 'md5:a8aa13e2b7ad36789e9f77a74b6de660',
+ 'thumbnail': 're:^https?://.*\.jpg$',
+ 'width': 480,
+ 'height': 360,
+ 'duration': 180,
+ },
+ },
+ {
+ 'url': 'http://5-tv.ru/video/1021729/',
+ 'md5': '299c8b72960efc9990acd2c784dc2296',
+ 'info_dict': {
+ 'id': '1021729',
+ 'ext': 'mp4',
+ 'title': '3D принтер',
+ 'description': 'md5:d76c736d29ef7ec5c0cf7d7c65ffcb41',
+ 'thumbnail': 're:^https?://.*\.jpg$',
+ 'width': 480,
+ 'height': 360,
+ 'duration': 180,
+ },
+ },
+ ]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, video_id)
+
+ video_link = self._search_regex(
+ r'(<a.*?class="videoplayer">)', webpage, 'video link')
+
+ url = self._search_regex(r'href="([^"]+)"', video_link, 'video url')
+ width = int_or_none(self._search_regex(
+ r'width:(\d+)px', video_link, 'width', default=None, fatal=False))
+ height = int_or_none(self._search_regex(
+ r'height:(\d+)px', video_link, 'height', default=None, fatal=False))
+ duration = int_or_none(self._og_search_property(
+ 'video:duration', webpage, 'duration'))
+ return {
+ 'id': video_id,
+ 'url': url,
+ 'width': width,
+ 'height': height,
+ 'title': self._og_search_title(webpage),
+ 'description': self._og_search_description(webpage),
+ 'thumbnail': self._og_search_thumbnail(webpage),
+ 'duration': duration,
+ }