aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Taccari <iamleot@gmail.com>2018-08-30 21:15:46 +0200
committerSergey M <dstftw@gmail.com>2018-08-31 02:15:46 +0700
commit73f3bdbeb4b62a1286bcd74fdd1d5741740ea845 (patch)
tree33a26f1f045a8a8b1d58555113ae0dc38b9f357c
parent9e21e6d96bed929ba57b8ce775e2a0e29e54dd60 (diff)
[internazionale] Fix extraction of non-available-abroad videos
-rw-r--r--youtube_dl/extractor/internazionale.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/youtube_dl/extractor/internazionale.py b/youtube_dl/extractor/internazionale.py
index 10ba1f6cf..676e8e269 100644
--- a/youtube_dl/extractor/internazionale.py
+++ b/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,13 @@ 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_available_abroad = self._search_regex(
+ DATA_RE % 'video-available_abroad', webpage,
+ 'video available aboard', default='1', group='value')
+ video_available_abroad = video_available_abroad == '1'
- video_base = 'https://video.internazionale.it/%s/%s.' % (video_path, video_id)
+ video_base = 'https://video%s.internazionale.it/%s/%s.' % \
+ ('' if video_available_abroad else '-ita', video_path, video_id)
formats = self._extract_m3u8_formats(
video_base + 'm3u8', display_id, 'mp4',