mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-19 20:10:25 +00:00
[internazionale] Improve extraction (closes #14973)
This commit is contained in:
parent
1ae0f0a21d
commit
640788f6f4
@ -2,45 +2,63 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_timestamp
|
||||||
|
|
||||||
|
|
||||||
class InternazionaleIE(InfoExtractor):
|
class InternazionaleIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?internazionale\.it/video/(?P<id>.*)'
|
_VALID_URL = r'https?://(?:www\.)?internazionale\.it/video/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
||||||
_TESTS = [{
|
_TEST = {
|
||||||
'url': 'https://www.internazionale.it/video/2015/02/19/richard-linklater-racconta-una-scena-di-boyhood',
|
'url': 'https://www.internazionale.it/video/2015/02/19/richard-linklater-racconta-una-scena-di-boyhood',
|
||||||
'md5': '11b54a3d3333e455c00684e50a65c58e',
|
'md5': '3e39d32b66882c1218e305acbf8348ca',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '265968',
|
'id': '265968',
|
||||||
|
'display_id': 'richard-linklater-racconta-una-scena-di-boyhood',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'description': 'md5:efb7e5bbfb1a54ae2ed5a4a015f0e665',
|
|
||||||
'title': 'Richard Linklater racconta una scena di Boyhood',
|
'title': 'Richard Linklater racconta una scena di Boyhood',
|
||||||
|
'description': 'md5:efb7e5bbfb1a54ae2ed5a4a015f0e665',
|
||||||
|
'timestamp': 1424354635,
|
||||||
|
'upload_date': '20150219',
|
||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
}
|
},
|
||||||
}]
|
'params': {
|
||||||
|
'format': 'bestvideo',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
|
||||||
|
|
||||||
data_job_id = self._html_search_regex(r'data-job-id="([^"]+)"', webpage, 'data-job-id')
|
webpage = self._download_webpage(url, display_id)
|
||||||
data_video_path = self._html_search_regex(r'data-video-path="([^"]+)"', webpage, 'data-video-path')
|
|
||||||
|
|
||||||
formats = []
|
DATA_RE = r'data-%s=(["\'])(?P<value>(?:(?!\1).)+)\1'
|
||||||
|
|
||||||
formats.extend(self._extract_m3u8_formats(
|
title = self._search_regex(
|
||||||
'https://video.internazionale.it/%s/%s.m3u8' % (data_video_path, data_job_id),
|
DATA_RE % 'video-title', webpage, 'title', default=None,
|
||||||
video_id))
|
group='value') or self._og_search_title(webpage)
|
||||||
|
|
||||||
|
video_id = self._search_regex(
|
||||||
|
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)
|
||||||
|
|
||||||
|
formats = self._extract_m3u8_formats(
|
||||||
|
video_base + 'm3u8', display_id, 'mp4',
|
||||||
|
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
|
||||||
formats.extend(self._extract_mpd_formats(
|
formats.extend(self._extract_mpd_formats(
|
||||||
'https://video.internazionale.it/%s/%s.mpd' % (data_video_path, data_job_id),
|
video_base + 'mpd', display_id, mpd_id='dash', fatal=False))
|
||||||
video_id))
|
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
timestamp = unified_timestamp(self._html_search_meta(
|
||||||
|
'article:published_time', webpage, 'timestamp'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': data_job_id,
|
'id': video_id,
|
||||||
'title': self._og_search_title(webpage),
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
|
'timestamp': timestamp,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user