Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idf1_extractor] Add new extractor (fulfilling support request #25671) #25735

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
HungamaSongIE,
)
from .hypem import HypemIE
from .idf1_extractor import IDF1IE
from .ign import (
IGNIE,
OneUPIE,
Expand Down Expand Up @@ -1516,3 +1517,4 @@
from .zdf import ZDFIE, ZDFChannelIE
from .zingmp3 import ZingMp3IE
from .zype import ZypeIE

43 changes: 43 additions & 0 deletions youtube_dl/extractor/idf1_extractor.py
Original file line number Diff line number Diff line change
@@ -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<id>[^/|.]+)\.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 &eacute;mission culte, tous les jours du lundi au vendredi &agrave; 17h00 sur IDF1&nbsp;!"',
'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&egrave;s 20h50 sur IDF1 pour l\'&eacute;mission ID Voyance &Icirc;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'<title[^>]*>(.+?)</title>', webpage, 'title', default='(no title available)')
description = self._html_search_regex(r'<meta[^>]*\sname=["|\']description["|\'][^>]*\scontent=(.+?)/>', webpage, 'description', fatal=False)
dacast_link = self._html_search_regex(r'<script\ssrc=([^\>]+)></script>', webpage, 'link')
dacast_link = url_or_none(dacast_link.replace('"', ''))
return {
'id': video_id,
'title': title,
'description': description,
'url': dacast_link,
}