From d3410d7f1a2573da9d54503f9b91a08c72b8b71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Wed, 13 Dec 2017 15:28:20 +0100 Subject: [PATCH 1/3] [iprima] Fix id extraction, add new valid URL patterns --- youtube_dl/extractor/iprima.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index a29e6a5ba..6007e7206 100644 --- a/youtube_dl/extractor/iprima.py +++ b/youtube_dl/extractor/iprima.py @@ -12,7 +12,7 @@ from ..utils import ( class IPrimaIE(InfoExtractor): - _VALID_URL = r'https?://play\.iprima\.cz/(?:.+/)?(?P[^?#]+)' + _VALID_URL = r'https?://(?:prima|cool|max|zoom|love|play)\.iprima\.cz/(?:.+/)?(?P[^?#]+)' _GEO_BYPASS = False _TESTS = [{ @@ -40,15 +40,16 @@ class IPrimaIE(InfoExtractor): webpage = self._download_webpage(url, video_id) - video_id = self._search_regex(r'data-product="([^"]+)">', webpage, 'real id') + video_id = self._search_regex(r'(?:prehravac/embedded\?id=|productId: \')(p[0-9]+)', webpage, 'real id') playerpage = self._download_webpage( - 'http://play.iprima.cz/prehravac/init', + 'http://api.play-backend.iprima.cz/prehravac/init-embed', video_id, note='Downloading player', query={ '_infuse': 1, '_ts': round(time.time()), 'productId': video_id, - }, headers={'Referer': url}) + 'embed': 'true', + }, headers={'Referer': 'http://api.play-backend.iprima.cz/prehravac/embedded?id=' + video_id}) formats = [] From a0cd4e4d7782502a6734d07509b6202ad25d618c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Wed, 13 Dec 2017 15:43:31 +0100 Subject: [PATCH 2/3] [iprima] replace test URLs that went 404 with working ones --- youtube_dl/extractor/iprima.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index 6007e7206..f69fd84ec 100644 --- a/youtube_dl/extractor/iprima.py +++ b/youtube_dl/extractor/iprima.py @@ -16,7 +16,7 @@ class IPrimaIE(InfoExtractor): _GEO_BYPASS = False _TESTS = [{ - 'url': 'http://play.iprima.cz/gondici-s-r-o-33', + 'url': 'http://play.iprima.cz/gondici-s-r-o/gondici-s-r-o-34', 'info_dict': { 'id': 'p136534', 'ext': 'mp4', @@ -31,7 +31,8 @@ class IPrimaIE(InfoExtractor): 'only_matching': True, }, { # geo restricted - 'url': 'http://play.iprima.cz/closer-nove-pripady/closer-nove-pripady-iv-1', + 'url': 'http://play.iprima.cz/closer-nove-pripady/closer-nove-pripady/closer-nove-pripady-' + 'iv-1/closer-nove-pripady-iv-1-upoutavka', 'only_matching': True, }] From 79a7f89a727d672b6901ec1a92e171d316f8a4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Wed, 13 Dec 2017 15:53:00 +0100 Subject: [PATCH 3/3] [iprima] add tests for the new URL scheme --- youtube_dl/extractor/iprima.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index f69fd84ec..ea46b9693 100644 --- a/youtube_dl/extractor/iprima.py +++ b/youtube_dl/extractor/iprima.py @@ -34,6 +34,28 @@ class IPrimaIE(InfoExtractor): 'url': 'http://play.iprima.cz/closer-nove-pripady/closer-nove-pripady/closer-nove-pripady-' 'iv-1/closer-nove-pripady-iv-1-upoutavka', 'only_matching': True, + }, { + 'url': 'http://prima.iprima.cz/zpravodajstvi/10122017-0', + 'info_dict': { + 'id': 'p407787', + 'ext': 'mp4', + 'title': 'Zpravodajství FTV Prima, Zpravodajství FTV Prima 10.12.2017 | Prima', + 'description': 'md5:d3640eaccd3a66423c86f8942d79d5ce', + }, + 'params': { + 'skip_download': True, # m3u8 download + }, + }, { + 'url': 'http://cool.iprima.cz/porady/tezka-drina/pila-0', + 'info_dict': { + 'id': 'p32629', + 'ext': 'mp4', + 'title': 'Těžká dřina, 5. epizoda - Pila | Prima Cool', + 'description': 'md5:ab9ad7b8af739fed79185c4e58bc599d', + }, + 'params': { + 'skip_download': True, # m3u8 download + }, }] def _real_extract(self, url):