From acb0f56569349b797469647fc9a358fcfa12f6a1 Mon Sep 17 00:00:00 2001 From: bmensah Date: Fri, 19 Jun 2020 17:08:13 -0400 Subject: [PATCH] [idf1_extractor] Add new extractor (fulfilling support request #25671) --- youtube_dl/extractor/extractors.py | 2 ++ youtube_dl/extractor/idf1_extractor.py | 43 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 youtube_dl/extractor/idf1_extractor.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 4b3092028..d899a3c73 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -451,6 +451,7 @@ from .hungama import ( HungamaSongIE, ) from .hypem import HypemIE +from .idf1_extractor import IDF1IE from .ign import ( IGNIE, OneUPIE, @@ -1516,3 +1517,4 @@ from .zattoo import ( from .zdf import ZDFIE, ZDFChannelIE from .zingmp3 import ZingMp3IE from .zype import ZypeIE + diff --git a/youtube_dl/extractor/idf1_extractor.py b/youtube_dl/extractor/idf1_extractor.py new file mode 100644 index 000000000..74d3515bf --- /dev/null +++ b/youtube_dl/extractor/idf1_extractor.py @@ -0,0 +1,43 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import url_or_none + + +class IDF1IE(InfoExtractor): + IE_NAME = 'IDF1' + _VALID_URL = r'https?://(?:www\.)?idf1\.fr/videos/(?:[^/|.]+)/(?P[^/|.]+)\.html' + _TESTS = [{ + 'url': 'https://www.idf1.fr/videos/jlpp/2020-05-29-partie-1.html', + 'info_dict': { + 'id': '2020-05-29-partie-1', + 'ext': 'js', + 'title': 'JLPP - 2020/05/29 - partie 1 sur le replay IDF1 - IDF1', + 'description': '"Jacky lave plus propre, votre nouvelle émission culte, tous les jours du lundi au vendredi à 17h00 sur IDF1 !"', + 'url': 'https://player.dacast.com/js/player.js?contentId=15863_f_890022', + }, + }, { + 'url': 'https://www.idf1.fr/videos/id-voyance/2020-03-13-partie-3.html', + 'info_dict': { + 'id': '2020-03-13-partie-3', + 'ext': 'js', + 'title': 'ID Voyance Île-de-France - 2020/03/13 - partie 3 sur le replay IDF1 - IDF1', + 'description': '"Isabelle et nos voyants en direct tous les vendredis dès 20h50 sur IDF1 pour l\'émission ID Voyance Île-de-France."', + 'url': 'https://player.dacast.com/js/player.js?contentId=15863_f_827665', + }, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + title = self._html_search_regex(r']*>(.+?)', webpage, 'title', default='(no title available)') + description = self._html_search_regex(r']*\sname=["|\']description["|\'][^>]*\scontent=(.+?)/>', webpage, 'description', fatal=False) + dacast_link = self._html_search_regex(r']+)>', webpage, 'link') + dacast_link = url_or_none(dacast_link.replace('"', '')) + return { + 'id': video_id, + 'title': title, + 'description': description, + 'url': dacast_link, + }