]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/heise.py
1 from .common
import InfoExtractor
2 from .kaltura
import KalturaIE
3 from .youtube
import YoutubeIE
14 class HeiseIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+-(?P<id>[0-9]+)\.html'
18 'url': 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html',
22 'title': "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone",
23 'timestamp': 1512734959,
24 'upload_date': '20171208',
25 'description': 'md5:c934cbfb326c669c2bcabcbe3d3fcd20',
28 'skip_download': True,
32 'url': 'http://www.heise.de/newsticker/meldung/Netflix-In-20-Jahren-vom-Videoverleih-zum-TV-Revolutionaer-3814130.html',
33 'md5': 'e403d2b43fea8e405e88e3f8623909f1',
37 'title': 'NEU IM SEPTEMBER | Netflix',
38 'description': 'md5:2131f3c7525e540d5fd841de938bd452',
39 'upload_date': '20170830',
40 'uploader': 'Netflix Deutschland, Österreich und Schweiz',
41 'uploader_id': 'netflixdach',
44 'skip_download': True,
47 'url': 'https://www.heise.de/video/artikel/nachgehakt-Wie-sichert-das-c-t-Tool-Restric-tor-Windows-10-ab-3700244.html',
51 'title': "nachgehakt: Wie sichert das c't-Tool Restric'tor Windows 10 ab?",
52 'description': 'md5:47e8ffb6c46d85c92c310a512d6db271',
53 'timestamp': 1512470717,
54 'upload_date': '20171205',
57 'skip_download': True,
60 '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',
64 'title': "c't uplink 20.8: Staubsaugerroboter Xiaomi Vacuum 2, AR-Brille Meta 2 und Android rooten",
65 'description': 'md5:f50fe044d3371ec73a8f79fcebd74afc',
66 'timestamp': 1517567237,
67 'upload_date': '20180202',
70 'skip_download': True,
73 'url': 'http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html',
74 'only_matching': True,
76 'url': 'http://www.heise.de/newsticker/meldung/c-t-uplink-Owncloud-Tastaturen-Peilsender-Smartphone-2404251.html?wt_mc=rss.ho.beitrag.atom',
77 'only_matching': True,
79 'url': 'http://www.heise.de/ct/ausgabe/2016-12-Spiele-3214137.html',
80 'only_matching': True,
83 def _real_extract(self
, url
):
84 video_id
= self
._match
_id
(url
)
85 webpage
= self
._download
_webpage
(url
, video_id
)
87 def extract_title(default
=NO_DEFAULT
):
88 title
= self
._html
_search
_meta
(
89 ('fulltitle', 'title'), webpage
, default
=None)
90 if not title
or title
== "c't":
91 title
= self
._search
_regex
(
92 r
'<div[^>]+class="videoplayerjw"[^>]+data-title="([^"]+)"',
93 webpage
, 'title', default
=None)
95 title
= self
._html
_search
_regex
(
96 r
'<h1[^>]+\bclass=["\']article_page_title
[^
>]+>(.+?
)<',
97 webpage, 'title
', default=default)
100 title = extract_title(default=None)
101 description = self._og_search_description(
102 webpage, default=None) or self._html_search_meta(
103 'description
', webpage)
105 def _make_kaltura_result(kaltura_url):
107 '_type
': 'url_transparent
',
108 'url
': smuggle_url(kaltura_url, {'source_url': url}),
109 'ie_key
': KalturaIE.ie_key(),
111 'description
': description,
114 kaltura_url = KalturaIE._extract_url(webpage)
116 return _make_kaltura_result(kaltura_url)
118 kaltura_id = self._search_regex(
119 r'entry
-id=(["\'])(?P<id>(?:(?!\1).)+)\1', webpage, 'kaltura id',
120 default=None, group='id')
122 return _make_kaltura_result('kaltura:2238431:%s' % kaltura_id)
124 yt_urls = YoutubeIE._extract_urls(webpage)
126 return self.playlist_from_matches(
127 yt_urls, video_id, title, ie=YoutubeIE.ie_key())
129 title = extract_title()
131 container_id = self._search_regex(
132 r'<div class="videoplayerjw
"[^>]+data-container="([0-9]+)"',
133 webpage, 'container ID')
135 sequenz_id = self._search_regex(
136 r'<div class="videoplayerjw
"[^>]+data-sequenz="([0-9]+)"',
137 webpage, 'sequenz ID')
139 doc = self._download_xml(
140 'http://www.heise.de/videout/feed', video_id, query={
141 'container': container_id,
142 'sequenz': sequenz_id,
146 for source_node in doc.findall('.//{http://rss.jwpcdn.com/}source'):
147 label = source_node.attrib['label']
148 height = int_or_none(self._search_regex(
149 r'^(.*?_)?([0-9]+)p$', label, 'height', default=None))
150 video_url = source_node.attrib['file']
151 ext = determine_ext(video_url, '')
154 'format_note': label,
155 'format_id': '%s_%s' % (ext, label),
158 self._sort_formats(formats)
163 'description': description,
164 'thumbnail': (xpath_text(doc, './/{http://rss.jwpcdn.com/}image')
165 or self._og_search_thumbnail(webpage)),
166 'timestamp': parse_iso8601(
167 self._html_search_meta('date', webpage)),