From 44b2c836ae93ee67d435d34da6839811e565837a Mon Sep 17 00:00:00 2001 From: kayb94 <> Date: Thu, 31 Aug 2017 16:49:14 +0200 Subject: [PATCH 1/2] [Heise] Add suport for embedded youtube videos and new c't uplink episodes. --- youtube_dl/extractor/heise.py | 114 ++++++++++++++++++++++++++++------ 1 file changed, 95 insertions(+), 19 deletions(-) diff --git a/youtube_dl/extractor/heise.py b/youtube_dl/extractor/heise.py index 382f32771..c5063f25a 100644 --- a/youtube_dl/extractor/heise.py +++ b/youtube_dl/extractor/heise.py @@ -9,16 +9,18 @@ from ..utils import ( xpath_text, ) +import re + class HeiseIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+-(?P[0-9]+)\.html' + _VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+-(?P[0-9]+)\.html'# noqa _TESTS = [{ - 'url': 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html', + 'url': 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html',# noqa 'md5': 'ffed432483e922e88545ad9f2f15d30e', 'info_dict': { 'id': '2404147', 'ext': 'mp4', - 'title': "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone", + 'title': "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone",# noqa 'format_id': 'mp4_720p', 'timestamp': 1411812600, 'upload_date': '20140927', @@ -26,10 +28,18 @@ class HeiseIE(InfoExtractor): 'thumbnail': r're:^https?://.*/gallery/$', } }, { - 'url': 'http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html', + 'url': 'https://www.heise.de/ct/artikel/c-t-uplink-18-5-Android-Oreo-Nokia-Galaxy-Note-8-AMD-Ryzen-Threadripper-3812972.html',# noqa + 'info_dict': { + 'id': '3812972', + 'ext': 'mp4', + 'title': "c't uplink 18.5: Android Oreo, Nokia, Galaxy Note 8, AMD Ryzen Threadripper",# noqa + 'description': 'md5:0601ade34ae5c4f5058d378327928348' + } + }, { + 'url': 'http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html',# noqa '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', + 'url': 'http://www.heise.de/newsticker/meldung/c-t-uplink-Owncloud-Tastaturen-Peilsender-Smartphone-2404251.html?wt_mc=rss.ho.beitrag.atom',# noqa 'only_matching': True, }, { 'url': 'http://www.heise.de/ct/ausgabe/2016-12-Spiele-3214137.html', @@ -40,24 +50,40 @@ class HeiseIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) + title = self._html_search_meta('fulltitle', webpage, default=None) + if not title or title == "c't": + title = self._search_regex( + r']+class="videoplayerjw"[^>]+data-title="([^"]+)"', + webpage, 'title') + + # Find embedded youtube videos + yt_videos = re.findall( + r'