aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/franceculture.py
diff options
context:
space:
mode:
authorRogério Brito <rbrito@ime.usp.br>2016-02-24 17:23:49 -0300
committerRogério Brito <rbrito@ime.usp.br>2016-02-24 17:23:49 -0300
commit9f2b33881274af98a9145c533a1d295fad71521a (patch)
treeb7e8f8ef288b2ec35a41261bb4774f9044cfce83 /youtube_dl/extractor/franceculture.py
parent9ed7fe4fe4c445eb7d9f3197bb300d0db8f1807a (diff)
downloadyoutube-dl-9f2b33881274af98a9145c533a1d295fad71521a.zip
youtube-dl-9f2b33881274af98a9145c533a1d295fad71521a.tar.gz
youtube-dl-9f2b33881274af98a9145c533a1d295fad71521a.tar.bz2
Imported Upstream version 2016.02.22
Diffstat (limited to 'youtube_dl/extractor/franceculture.py')
-rw-r--r--youtube_dl/extractor/franceculture.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/youtube_dl/extractor/franceculture.py b/youtube_dl/extractor/franceculture.py
index 1e83a4e..e2ca962 100644
--- a/youtube_dl/extractor/franceculture.py
+++ b/youtube_dl/extractor/franceculture.py
@@ -8,6 +8,7 @@ from ..compat import (
from ..utils import (
determine_ext,
int_or_none,
+ ExtractorError,
)
@@ -22,14 +23,13 @@ class FranceCultureIE(InfoExtractor):
'alt_title': 'Carnet nomade | 13-14',
'vcodec': 'none',
'upload_date': '20140301',
- 'thumbnail': r're:^http://www\.franceculture\.fr/.*/images/player/Carnet-nomade\.jpg$',
- 'description': 'startswith:Avec :Jean-Baptiste Péretié pour son documentaire sur Arte "La revanche des « geeks », une enquête menée aux Etats',
+ 'thumbnail': r're:^http://static\.franceculture\.fr/.*/images/player/Carnet-nomade\.jpg$',
+ 'description': 'startswith:Avec :Jean-Baptiste Péretié pour son documentaire sur Arte "La revanche',
'timestamp': 1393700400,
}
}
- def _real_extract(self, url):
- video_id = self._match_id(url)
+ def _extract_from_player(self, url, video_id):
webpage = self._download_webpage(url, video_id)
video_path = self._search_regex(
@@ -42,6 +42,9 @@ class FranceCultureIE(InfoExtractor):
r'<a id="player".*?>\s+<img src="([^"]+)"',
webpage, 'thumbnail', fatal=False)
+ display_id = self._search_regex(
+ r'<span class="path-diffusion">emission-(.*?)</span>', webpage, 'display_id')
+
title = self._html_search_regex(
r'<span class="title-diffusion">(.*?)</span>', webpage, 'title')
alt_title = self._html_search_regex(
@@ -66,4 +69,37 @@ class FranceCultureIE(InfoExtractor):
'alt_title': alt_title,
'thumbnail': thumbnail,
'description': description,
+ 'display_id': display_id,
}
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ return self._extract_from_player(url, video_id)
+
+
+class FranceCultureEmissionIE(FranceCultureIE):
+ _VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emission-(?P<id>[^?#]+)'
+ _TEST = {
+ 'url': 'http://www.franceculture.fr/emission-les-carnets-de-la-creation-jean-gabriel-periot-cineaste-2015-10-13',
+ 'info_dict': {
+ 'title': 'Jean-Gabriel Périot, cinéaste',
+ 'alt_title': 'Les Carnets de la création',
+ 'id': '5093239',
+ 'display_id': 'les-carnets-de-la-creation-jean-gabriel-periot-cineaste-2015-10-13',
+ 'ext': 'mp3',
+ 'timestamp': 1444762500,
+ 'upload_date': '20151013',
+ 'description': 'startswith:Aujourd\'hui dans "Les carnets de la création", le cinéaste',
+ },
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+ video_path = self._html_search_regex(
+ r'<a class="rf-player-open".*?href="([^"]+)"', webpage, 'video path', 'no_path_player')
+ if video_path == 'no_path_player':
+ raise ExtractorError('no player : no sound in this page.', expected=True)
+ new_id = self._search_regex('play=(?P<id>[0-9]+)', video_path, 'new_id', group='id')
+ video_url = compat_urlparse.urljoin(url, video_path)
+ return self._extract_from_player(video_url, new_id)