From 5962ecc6909ce0d3db7135da40b543bf30d5d591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 7 Jul 2019 20:26:14 -0300 Subject: [PATCH 1/2] [vera] Add extractor for channels --- docs/supportedsites.md | 1 + youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/vera.py | 80 ++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 youtube_dl/extractor/vera.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 55ae43144..c2d0b4d35 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -997,6 +997,7 @@ - **Vbox7** - **VeeHD** - **Veoh** + - **Vera** - **verystream** - **Vessel** - **Vesti**: Вести.Ru diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 02f17cf0d..46141ca29 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1280,6 +1280,7 @@ from .varzesh3 import Varzesh3IE from .vbox7 import Vbox7IE from .veehd import VeeHDIE from .veoh import VeohIE +from .vera import VeraIE from .vessel import VesselIE from .vesti import VestiIE from .vevo import ( diff --git a/youtube_dl/extractor/vera.py b/youtube_dl/extractor/vera.py new file mode 100644 index 000000000..059fb48e9 --- /dev/null +++ b/youtube_dl/extractor/vera.py @@ -0,0 +1,80 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class VeraIE(InfoExtractor): + _VALID_URL = r'https?://tv\.vera\.com\.uy/canal/(?P[0-9]+)' + _TESTS = [{ + 'url': 'http://tv.vera.com.uy/canal/6001', + 'info_dict': { + 'id': '6001', + 'ext': 'mp4', + 'title': r're:^Vera\+ HD [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'description': 'md5:b3696ac8131004491079f61650856444', + 'thumbnail': r're:^https?://.*\.jpg$', + }, + 'params': { + 'skip_download': True, + } + }, { + 'url': 'http://tv.vera.com.uy/canal/6042', + 'info_dict': { + 'id': '6042', + 'ext': 'mp4', + 'title': r're:^Televisión Nacional [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'description': 'md5:91472413c939a91c45ad50f2d5ccf453', + 'thumbnail': r're:^https?://.*\.jpg$', + }, + 'params': { + 'skip_download': True, + } + }, { + 'url': 'http://tv.vera.com.uy/canal/6046', + 'info_dict': { + 'id': '6046', + 'ext': 'mp4', + 'title': r're:^TVCIUDAD [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'description': 'md5:aaee7e00ac0b0b1c04766f77fed6bbe9', + 'thumbnail': r're:^https?://.*\.jpg$', + }, + 'params': { + 'skip_download': True, + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex( + r'

(.+?)

', + webpage, 'title') + description = self._html_search_regex( + r'(?s)

(.+?)

', + webpage, 'description') + thumbnail = self._html_search_regex( + r'(?s)
\s* Date: Sun, 7 Jul 2019 22:04:54 -0300 Subject: [PATCH 2/2] [vera] Add support for videos --- youtube_dl/extractor/vera.py | 48 +++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/youtube_dl/extractor/vera.py b/youtube_dl/extractor/vera.py index 059fb48e9..b55de6df4 100644 --- a/youtube_dl/extractor/vera.py +++ b/youtube_dl/extractor/vera.py @@ -5,11 +5,11 @@ from .common import InfoExtractor class VeraIE(InfoExtractor): - _VALID_URL = r'https?://tv\.vera\.com\.uy/canal/(?P[0-9]+)' + _VALID_URL = r'https?://tv\.vera\.com\.uy/(?P(?:canal|video)/[0-9]+)' _TESTS = [{ 'url': 'http://tv.vera.com.uy/canal/6001', 'info_dict': { - 'id': '6001', + 'id': 'canal/6001', 'ext': 'mp4', 'title': r're:^Vera\+ HD [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'description': 'md5:b3696ac8131004491079f61650856444', @@ -21,7 +21,7 @@ class VeraIE(InfoExtractor): }, { 'url': 'http://tv.vera.com.uy/canal/6042', 'info_dict': { - 'id': '6042', + 'id': 'canal/6042', 'ext': 'mp4', 'title': r're:^Televisión Nacional [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'description': 'md5:91472413c939a91c45ad50f2d5ccf453', @@ -33,7 +33,7 @@ class VeraIE(InfoExtractor): }, { 'url': 'http://tv.vera.com.uy/canal/6046', 'info_dict': { - 'id': '6046', + 'id': 'canal/6046', 'ext': 'mp4', 'title': r're:^TVCIUDAD [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'description': 'md5:aaee7e00ac0b0b1c04766f77fed6bbe9', @@ -42,21 +42,41 @@ class VeraIE(InfoExtractor): 'params': { 'skip_download': True, } + }, { + 'url': 'http://tv.vera.com.uy/video/38351', + 'md5': '6d7a5530c6041ac3808438c0584cbbfc', + 'info_dict': { + 'id': 'video/38351', + 'ext': 'mp4', + 'title': r'Mario Orlando Hardy Hamlet Brenno Benedetti Farrugia', + 'description': None, + 'thumbnail': r're:^https?://.*\.jpg$', + } }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - title = self._html_search_regex( - r'

(.+?)

', - webpage, 'title') - description = self._html_search_regex( - r'(?s)

(.+?)

', - webpage, 'description') - thumbnail = self._html_search_regex( - r'(?s)
\s*(.+?)', + webpage, 'title') + title = self._live_title(title) + description = self._html_search_regex( + r'(?s)

(.+?)

', + webpage, 'description') + thumbnail = self._html_search_regex( + r'(?s)
\s*\s*

(.+?)

', + webpage, 'title') + description = None + thumbnail = "http://veratvimgs.cdn.antel.net.uy/dynamic/content_images/" + num + "/240/default.jpg" iframe_url = self._html_search_regex( r'#iframePlayerContent\'.*\'(http:\/\/.*extras.*)\'', @@ -72,7 +92,7 @@ class VeraIE(InfoExtractor): return { 'id': video_id, - 'title': self._live_title(title), + 'title': title, 'description': description, 'thumbnail': thumbnail, 'url': playlist_url,