From 92944ea6ff702e45c36a2a962984b54d4ecb5257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Fri, 15 Dec 2017 01:43:47 +0100 Subject: [PATCH 1/3] [iprima] Extend valid URL pattern with the new subdomains --- youtube_dl/extractor/iprima.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index a29e6a5ba..c2deb4113 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 = [{ From 1cfc55c9f0926801c81c13f3036a488f2bd2652e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Fri, 15 Dec 2017 01:44:58 +0100 Subject: [PATCH 2/3] [iprima] Fix ID extraction and page download --- youtube_dl/extractor/iprima.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index c2deb4113..6007e7206 100644 --- a/youtube_dl/extractor/iprima.py +++ b/youtube_dl/extractor/iprima.py @@ -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 5028f750d4544594dd64b82f0270d29fb3ae9667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Helebrant?= Date: Fri, 15 Dec 2017 01:45:33 +0100 Subject: [PATCH 3/3] [iprima] Update 404ed URLs in tests, add testcases with the new URL scheme --- youtube_dl/extractor/iprima.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/iprima.py b/youtube_dl/extractor/iprima.py index 6007e7206..ea46b9693 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,8 +31,31 @@ 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, + }, { + '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):