Fix internazionale extractor - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 86fc088089f3c665ea6a60a93056b2d4fc90769d
(DIR) parent 36716492067c25d3c5313bd4f0aee1d2f4c1675f
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Thu, 30 Aug 2018 20:22:10
Fix internazionale extractor
Diffstat:
net/youtube-dl/patch-youtube_dl_extractor_internazionale.py | 62 +++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
---
diff -r 36716492067c -r 86fc088089f3 net/youtube-dl/patch-youtube_dl_extractor_internazionale.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/youtube-dl/patch-youtube_dl_extractor_internazionale.py Thu Aug 30 20:22:10 2018 +0200
@@ -0,0 +1,62 @@
+$NetBSD$
+
+Adjust video_base if the video is not available abroad.
+
+Shared upstream via:
+
+ <https://github.com/rg3/youtube-dl/pull/17386>
+
+--- youtube_dl/extractor/internazionale.py.orig 2018-08-27 20:08:34.000000000 +0000
++++ youtube_dl/extractor/internazionale.py
+@@ -7,7 +7,7 @@ from ..utils import unified_timestamp
+
+ class InternazionaleIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?internazionale\.it/video/(?:[^/]+/)*(?P<id>[^/?#&]+)'
+- _TEST = {
++ _TESTS = [{
+ 'url': 'https://www.internazionale.it/video/2015/02/19/richard-linklater-racconta-una-scena-di-boyhood',
+ 'md5': '3e39d32b66882c1218e305acbf8348ca',
+ 'info_dict': {
+@@ -23,7 +23,23 @@ class InternazionaleIE(InfoExtractor):
+ 'params': {
+ 'format': 'bestvideo',
+ },
+- }
++ }, {
++ 'url': 'https://www.internazionale.it/video/2018/08/29/telefono-stare-con-noi-stessi',
++ 'md5': '9db8663704cab73eb972d1cee0082c79',
++ 'info_dict': {
++ 'id': '761344',
++ 'display_id': 'telefono-stare-con-noi-stessi',
++ 'ext': 'mp4',
++ 'title': 'Usiamo il telefono per evitare di stare con noi stessi',
++ 'description': 'md5:75ccfb0d6bcefc6e7428c68b4aa1fe44',
++ 'timestamp': 1535528954,
++ 'upload_date': '20180829',
++ 'thumbnail': r're:^https?://.*\.jpg$',
++ },
++ 'params': {
++ 'format': 'bestvideo',
++ },
++ }]
+
+ def _real_extract(self, url):
+ display_id = self._match_id(url)
+@@ -40,8 +56,15 @@ class InternazionaleIE(InfoExtractor):
+ DATA_RE % 'job-id', webpage, 'video id', group='value')
+ video_path = self._search_regex(
+ DATA_RE % 'video-path', webpage, 'video path', group='value')
+-
+- video_base = 'https://video.internazionale.it/%s/%s.' % (video_path, video_id)
++ video_available_abroad = bool(int(self._search_regex(
++ DATA_RE % 'video-available_abroad', webpage,
++ 'video available aboard', default='1', group='value')))
++
++ if video_available_abroad:
++ video_base = 'https://video.internazionale.it/'
++ else:
++ video_base = 'https://video-ita.internazionale.it/'
++ video_base = video_base + '%s/%s.' % (video_path, video_id)
+
+ formats = self._extract_m3u8_formats(
+ video_base + 'm3u8', display_id, 'mp4',