2022-09-25 18:58:06 -06:00
|
|
|
|
import urllib.parse
|
|
|
|
|
|
2014-09-27 11:28:01 -06:00
|
|
|
|
from .common import InfoExtractor
|
2018-03-06 09:10:01 -07:00
|
|
|
|
from .kaltura import KalturaIE
|
2017-09-17 09:46:52 -06:00
|
|
|
|
from .youtube import YoutubeIE
|
2014-09-27 11:28:01 -06:00
|
|
|
|
from ..utils import (
|
2022-09-25 18:58:06 -06:00
|
|
|
|
NO_DEFAULT,
|
2014-11-04 15:14:16 -07:00
|
|
|
|
determine_ext,
|
2014-10-26 18:33:49 -06:00
|
|
|
|
int_or_none,
|
2014-09-27 11:28:01 -06:00
|
|
|
|
parse_iso8601,
|
2018-03-06 09:10:01 -07:00
|
|
|
|
smuggle_url,
|
2017-02-17 09:09:40 -07:00
|
|
|
|
xpath_text,
|
2014-09-27 11:28:01 -06:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HeiseIE(InfoExtractor):
|
2017-02-17 09:09:40 -07:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+-(?P<id>[0-9]+)\.html'
|
|
|
|
|
_TESTS = [{
|
2018-03-15 09:37:41 -06:00
|
|
|
|
# kaltura embed
|
2017-02-17 09:09:40 -07:00
|
|
|
|
'url': 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html',
|
|
|
|
|
'info_dict': {
|
2018-03-15 09:37:41 -06:00
|
|
|
|
'id': '1_kkrq94sm',
|
2017-02-17 09:09:40 -07:00
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone",
|
2018-03-15 09:37:41 -06:00
|
|
|
|
'timestamp': 1512734959,
|
|
|
|
|
'upload_date': '20171208',
|
2017-02-17 09:09:40 -07:00
|
|
|
|
'description': 'md5:c934cbfb326c669c2bcabcbe3d3fcd20',
|
2022-09-25 18:58:06 -06:00
|
|
|
|
'thumbnail': 're:^https?://.*/thumbnail/.*',
|
|
|
|
|
'duration': 2845,
|
|
|
|
|
'view_count': int,
|
2018-03-15 09:37:41 -06:00
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
},
|
2017-09-17 09:46:52 -06:00
|
|
|
|
}, {
|
|
|
|
|
# YouTube embed
|
|
|
|
|
'url': 'http://www.heise.de/newsticker/meldung/Netflix-In-20-Jahren-vom-Videoverleih-zum-TV-Revolutionaer-3814130.html',
|
|
|
|
|
'md5': 'e403d2b43fea8e405e88e3f8623909f1',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '6kmWbXleKW4',
|
|
|
|
|
'ext': 'mp4',
|
2022-09-25 18:58:06 -06:00
|
|
|
|
'title': 'Neu im September 2017 | Netflix',
|
|
|
|
|
'description': 'md5:d6852d1f96bb80760608eed3b907437c',
|
2017-09-17 09:46:52 -06:00
|
|
|
|
'upload_date': '20170830',
|
|
|
|
|
'uploader': 'Netflix Deutschland, Österreich und Schweiz',
|
|
|
|
|
'uploader_id': 'netflixdach',
|
2022-09-25 18:58:06 -06:00
|
|
|
|
'categories': ['Entertainment'],
|
|
|
|
|
'tags': 'count:27',
|
|
|
|
|
'age_limit': 0,
|
|
|
|
|
'availability': 'public',
|
|
|
|
|
'comment_count': int,
|
|
|
|
|
'channel_id': 'UCZqgRlLcvO3Fnx_npQJygcQ',
|
|
|
|
|
'thumbnail': 'https://i.ytimg.com/vi_webp/6kmWbXleKW4/maxresdefault.webp',
|
|
|
|
|
'uploader_url': 'http://www.youtube.com/user/netflixdach',
|
|
|
|
|
'playable_in_embed': True,
|
|
|
|
|
'live_status': 'not_live',
|
|
|
|
|
'channel_url': 'https://www.youtube.com/channel/UCZqgRlLcvO3Fnx_npQJygcQ',
|
|
|
|
|
'view_count': int,
|
|
|
|
|
'channel': 'Netflix Deutschland, Österreich und Schweiz',
|
|
|
|
|
'channel_follower_count': int,
|
|
|
|
|
'like_count': int,
|
|
|
|
|
'duration': 67,
|
2017-09-17 09:46:52 -06:00
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
},
|
2018-03-06 09:10:01 -07:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'https://www.heise.de/video/artikel/nachgehakt-Wie-sichert-das-c-t-Tool-Restric-tor-Windows-10-ab-3700244.html',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '1_ntrmio2s',
|
2018-03-15 09:37:41 -06:00
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': "nachgehakt: Wie sichert das c't-Tool Restric'tor Windows 10 ab?",
|
|
|
|
|
'description': 'md5:47e8ffb6c46d85c92c310a512d6db271',
|
2018-03-06 09:10:01 -07:00
|
|
|
|
'timestamp': 1512470717,
|
|
|
|
|
'upload_date': '20171205',
|
2022-09-25 18:58:06 -06:00
|
|
|
|
'duration': 786,
|
|
|
|
|
'view_count': int,
|
|
|
|
|
'thumbnail': 're:^https?://.*/thumbnail/.*',
|
2018-03-15 09:37:41 -06:00
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
},
|
|
|
|
|
}, {
|
2022-09-25 18:58:06 -06:00
|
|
|
|
# FIXME: Video m3u8 fails to download; issue with Kaltura extractor
|
2018-03-15 09:37:41 -06:00
|
|
|
|
'url': 'https://www.heise.de/ct/artikel/c-t-uplink-20-8-Staubsaugerroboter-Xiaomi-Vacuum-2-AR-Brille-Meta-2-und-Android-rooten-3959893.html',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '1_59mk80sf',
|
2018-03-06 09:10:01 -07:00
|
|
|
|
'ext': 'mp4',
|
2018-03-15 09:37:41 -06:00
|
|
|
|
'title': "c't uplink 20.8: Staubsaugerroboter Xiaomi Vacuum 2, AR-Brille Meta 2 und Android rooten",
|
|
|
|
|
'description': 'md5:f50fe044d3371ec73a8f79fcebd74afc',
|
|
|
|
|
'timestamp': 1517567237,
|
|
|
|
|
'upload_date': '20180202',
|
2018-03-06 09:10:01 -07:00
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
},
|
2022-09-25 18:58:06 -06:00
|
|
|
|
}, {
|
|
|
|
|
# videout
|
|
|
|
|
'url': 'https://www.heise.de/ct/artikel/c-t-uplink-3-8-Anonyme-SIM-Karten-G-Sync-Monitore-Citizenfour-2440327.html',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '2440327',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'c\'t uplink 3.8: Anonyme SIM-Karten, G-Sync-Monitore, Citizenfour',
|
|
|
|
|
'thumbnail': 'http://www.heise.de/imagine/yxM2qmol0xV3iFB7qFb70dGvXjc/gallery/',
|
|
|
|
|
'description': 'md5:fa164d8c8707dff124a9626d39205f5d',
|
|
|
|
|
'timestamp': 1414825200,
|
|
|
|
|
'upload_date': '20141101',
|
2024-06-11 17:09:58 -06:00
|
|
|
|
},
|
2017-02-17 09:09:40 -07:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://www.heise.de/newsticker/meldung/c-t-uplink-Owncloud-Tastaturen-Peilsender-Smartphone-2404251.html?wt_mc=rss.ho.beitrag.atom',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://www.heise.de/ct/ausgabe/2016-12-Spiele-3214137.html',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}]
|
2014-09-27 11:28:01 -06:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-09-28 02:40:49 -06:00
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2014-10-26 18:33:49 -06:00
|
|
|
|
|
2018-03-15 09:37:41 -06:00
|
|
|
|
def extract_title(default=NO_DEFAULT):
|
|
|
|
|
title = self._html_search_meta(
|
|
|
|
|
('fulltitle', 'title'), webpage, default=None)
|
|
|
|
|
if not title or title == "c't":
|
|
|
|
|
title = self._search_regex(
|
|
|
|
|
r'<div[^>]+class="videoplayerjw"[^>]+data-title="([^"]+)"',
|
|
|
|
|
webpage, 'title', default=None)
|
|
|
|
|
if not title:
|
|
|
|
|
title = self._html_search_regex(
|
|
|
|
|
r'<h1[^>]+\bclass=["\']article_page_title[^>]+>(.+?)<',
|
|
|
|
|
webpage, 'title', default=default)
|
|
|
|
|
return title
|
2017-09-17 09:46:52 -06:00
|
|
|
|
|
2018-03-15 09:37:41 -06:00
|
|
|
|
title = extract_title(default=None)
|
|
|
|
|
description = self._og_search_description(
|
|
|
|
|
webpage, default=None) or self._html_search_meta(
|
|
|
|
|
'description', webpage)
|
2017-09-17 09:46:52 -06:00
|
|
|
|
|
2019-09-26 10:11:02 -06:00
|
|
|
|
def _make_kaltura_result(kaltura_url):
|
2018-03-15 09:37:41 -06:00
|
|
|
|
return {
|
|
|
|
|
'_type': 'url_transparent',
|
|
|
|
|
'url': smuggle_url(kaltura_url, {'source_url': url}),
|
|
|
|
|
'ie_key': KalturaIE.ie_key(),
|
|
|
|
|
'title': title,
|
|
|
|
|
'description': description,
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-26 10:11:02 -06:00
|
|
|
|
kaltura_url = KalturaIE._extract_url(webpage)
|
|
|
|
|
if kaltura_url:
|
|
|
|
|
return _make_kaltura_result(kaltura_url)
|
|
|
|
|
|
|
|
|
|
kaltura_id = self._search_regex(
|
|
|
|
|
r'entry-id=(["\'])(?P<id>(?:(?!\1).)+)\1', webpage, 'kaltura id',
|
|
|
|
|
default=None, group='id')
|
|
|
|
|
if kaltura_id:
|
2024-06-11 17:09:58 -06:00
|
|
|
|
return _make_kaltura_result(f'kaltura:2238431:{kaltura_id}')
|
2019-09-26 10:11:02 -06:00
|
|
|
|
|
2022-08-06 15:59:19 -06:00
|
|
|
|
yt_urls = tuple(YoutubeIE._extract_embed_urls(url, webpage))
|
2018-03-15 09:37:41 -06:00
|
|
|
|
if yt_urls:
|
|
|
|
|
return self.playlist_from_matches(
|
|
|
|
|
yt_urls, video_id, title, ie=YoutubeIE.ie_key())
|
|
|
|
|
|
|
|
|
|
title = extract_title()
|
2022-09-25 18:58:06 -06:00
|
|
|
|
api_params = urllib.parse.parse_qs(
|
|
|
|
|
self._search_regex(r'/videout/feed\.json\?([^\']+)', webpage, 'feed params', default=None) or '')
|
|
|
|
|
if not api_params or 'container' not in api_params or 'sequenz' not in api_params:
|
|
|
|
|
container_id = self._search_regex(
|
|
|
|
|
r'<div class="videoplayerjw"[^>]+data-container="([0-9]+)"',
|
|
|
|
|
webpage, 'container ID')
|
2018-03-06 09:10:01 -07:00
|
|
|
|
|
2022-09-25 18:58:06 -06:00
|
|
|
|
sequenz_id = self._search_regex(
|
|
|
|
|
r'<div class="videoplayerjw"[^>]+data-sequenz="([0-9]+)"',
|
|
|
|
|
webpage, 'sequenz ID')
|
|
|
|
|
api_params = {
|
2017-02-17 09:09:40 -07:00
|
|
|
|
'container': container_id,
|
|
|
|
|
'sequenz': sequenz_id,
|
2022-09-25 18:58:06 -06:00
|
|
|
|
}
|
|
|
|
|
doc = self._download_xml(
|
|
|
|
|
'http://www.heise.de/videout/feed', video_id, query=api_params)
|
2014-09-27 11:28:01 -06:00
|
|
|
|
|
|
|
|
|
formats = []
|
2014-10-26 18:33:49 -06:00
|
|
|
|
for source_node in doc.findall('.//{http://rss.jwpcdn.com/}source'):
|
|
|
|
|
label = source_node.attrib['label']
|
|
|
|
|
height = int_or_none(self._search_regex(
|
|
|
|
|
r'^(.*?_)?([0-9]+)p$', label, 'height', default=None))
|
2014-11-04 15:14:16 -07:00
|
|
|
|
video_url = source_node.attrib['file']
|
|
|
|
|
ext = determine_ext(video_url, '')
|
2014-10-26 18:33:49 -06:00
|
|
|
|
formats.append({
|
2014-11-04 15:14:16 -07:00
|
|
|
|
'url': video_url,
|
2014-10-26 18:33:49 -06:00
|
|
|
|
'format_note': label,
|
2024-06-11 17:09:58 -06:00
|
|
|
|
'format_id': f'{ext}_{label}',
|
2014-10-26 18:33:49 -06:00
|
|
|
|
'height': height,
|
|
|
|
|
})
|
2014-09-27 11:28:01 -06:00
|
|
|
|
|
2017-02-17 09:09:40 -07:00
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
|
|
|
|
'title': title,
|
|
|
|
|
'description': description,
|
2019-05-10 14:56:22 -06:00
|
|
|
|
'thumbnail': (xpath_text(doc, './/{http://rss.jwpcdn.com/}image')
|
|
|
|
|
or self._og_search_thumbnail(webpage)),
|
2017-02-17 09:09:40 -07:00
|
|
|
|
'timestamp': parse_iso8601(
|
|
|
|
|
self._html_search_meta('date', webpage)),
|
|
|
|
|
'formats': formats,
|
|
|
|
|
}
|