From 98f65cd5d296b209b4e6213c8a81b6af627bee15 Mon Sep 17 00:00:00 2001 From: Nick Triller Date: Fri, 12 Feb 2016 22:40:53 +0100 Subject: [PATCH 1/4] Added rte.ie/archives extractor #8525 --- youtube_dl/extractor/__init__.py | 2 +- youtube_dl/extractor/rte.py | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 7056cf323..6299a6e38 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -590,7 +590,7 @@ from .ro220 import Ro220IE from .rottentomatoes import RottenTomatoesIE from .roxwel import RoxwelIE from .rtbf import RTBFIE -from .rte import RteIE, RteRadioIE +from .rte import RteIE, RteRadioIE, RteArchivesIE from .rtlnl import RtlNlIE from .rtl2 import RTL2IE from .rtp import RTPIE diff --git a/youtube_dl/extractor/rte.py b/youtube_dl/extractor/rte.py index 73c9788be..35aef204f 100644 --- a/youtube_dl/extractor/rte.py +++ b/youtube_dl/extractor/rte.py @@ -11,6 +11,65 @@ from ..utils import ( ) +class RteArchivesIE(InfoExtractor): + IE_NAME = 'rte:archives' + IE_DESC = 'Raidió Teilifís Éireann archives' + _VALID_URL = r'https?://(?:www\.)?rte\.ie/archives/\d{4}/\d{4}/(?P[0-9]+)[^/]+/?' + _TEST = { + 'url': 'http://www.rte.ie/archives/2016/0210/766882-beat-of-the-feet/', + 'info_dict': { + 'id': '10526837', + 'ext': 'flv', + 'title': 'Beat Of The Feet', + 'thumbnail': 're:^https?://.*\.jpg$', + 'description': 'Battering requires the dancer to beat out a rhythm on the floor with their feet.', + 'duration': 255.001, + 'display_id': '766882' + }, + 'params': { + 'skip_download': 'f4m fails with --test atm' + } + } + + def _real_extract(self, url): + # meta tag with name="av" contains this id, too + id_pattern = r'', webpage, 'thumbnail') + thumbnail = None + if thumbnail_id is not None: + thumbnail = 'http://img.rasset.ie/' + thumbnail_id + '.jpg' + + feeds_url = 'http://www.rte.ie/rteavgen/getplaylist/?format=json&id=' + video_id + json_string = self._download_json(feeds_url, video_id) + + # f4m_url = server + relative_url + f4m_url = json_string['shows'][0]['media:group'][0]['hds_server'] + json_string['shows'][0]['media:group'][0]['hds_url'] + f4m_formats = self._extract_f4m_formats(f4m_url, video_id) + duration = None + try: + duration = float_or_none(json_string['shows'][0]['media:group'][0]['duration'], 1000) + except KeyError: + pass + + return { + 'id': video_id, + 'title': title, + 'formats': f4m_formats, + 'description': description, + 'thumbnail': thumbnail, + 'duration': duration, + 'display_id': display_id + } + + class RteIE(InfoExtractor): IE_NAME = 'rte' IE_DESC = 'Raidió Teilifís Éireann TV' From b4e3f3435e68cfa247a075535d21167852c0e3eb Mon Sep 17 00:00:00 2001 From: Nick Triller Date: Wed, 20 Jul 2016 17:18:59 +0200 Subject: [PATCH 2/4] Resolves merge conflict --- youtube_dl/extractor/__init__.py | 2 +- youtube_dl/extractor/rte.py | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 18d8dbcd6..82c3983f3 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -43,4 +43,4 @@ def list_extractors(age_limit): def get_info_extractor(ie_name): """Returns the info extractor class with the given ie_name""" - return globals()[ie_name + 'IE'] +return globals()[ie_name + 'IE'] \ No newline at end of file diff --git a/youtube_dl/extractor/rte.py b/youtube_dl/extractor/rte.py index ebe563ebb..207ecd2c4 100644 --- a/youtube_dl/extractor/rte.py +++ b/youtube_dl/extractor/rte.py @@ -11,6 +11,65 @@ from ..utils import ( ) +class RteArchivesIE(InfoExtractor): + IE_NAME = 'rte:archives' + IE_DESC = 'Raidió Teilifís Éireann archives' + _VALID_URL = r'https?://(?:www\.)?rte\.ie/archives/\d{4}/\d{4}/(?P[0-9]+)[^/]+/?' + _TEST = { + 'url': 'http://www.rte.ie/archives/2016/0210/766882-beat-of-the-feet/', + 'info_dict': { + 'id': '10526837', + 'ext': 'flv', + 'title': 'Beat Of The Feet', + 'thumbnail': 're:^https?://.*\.jpg$', + 'description': 'Battering requires the dancer to beat out a rhythm on the floor with their feet.', + 'duration': 255.001, + 'display_id': '766882' + }, + 'params': { + 'skip_download': 'f4m fails with --test atm' + } + } + + def _real_extract(self, url): + # meta tag with name="av" contains this id, too + id_pattern = r'', webpage, 'thumbnail') + thumbnail = None + if thumbnail_id is not None: + thumbnail = 'http://img.rasset.ie/' + thumbnail_id + '.jpg' + + feeds_url = 'http://www.rte.ie/rteavgen/getplaylist/?format=json&id=' + video_id + json_string = self._download_json(feeds_url, video_id) + + # f4m_url = server + relative_url + f4m_url = json_string['shows'][0]['media:group'][0]['hds_server'] + json_string['shows'][0]['media:group'][0]['hds_url'] + f4m_formats = self._extract_f4m_formats(f4m_url, video_id) + duration = None + try: + duration = float_or_none(json_string['shows'][0]['media:group'][0]['duration'], 1000) + except KeyError: + pass + + return { + 'id': video_id, + 'title': title, + 'formats': f4m_formats, + 'description': description, + 'thumbnail': thumbnail, + 'duration': duration, + 'display_id': display_id + } + + class RteIE(InfoExtractor): IE_NAME = 'rte' IE_DESC = 'Raidió Teilifís Éireann TV' From cbf9cda9765de66bb4357ae34ee095bad96b30c9 Mon Sep 17 00:00:00 2001 From: Nick Triller Date: Wed, 20 Jul 2016 17:28:33 +0200 Subject: [PATCH 3/4] Added RteArchivesIE extractor to extractory.py --- youtube_dl/extractor/extractors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 6de50296c..64c83e132 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -691,7 +691,7 @@ from .roosterteeth import RoosterTeethIE from .rottentomatoes import RottenTomatoesIE from .roxwel import RoxwelIE from .rtbf import RTBFIE -from .rte import RteIE, RteRadioIE +from .rte import RteIE, RteRadioIE, RteArchivesIE from .rtlnl import RtlNlIE from .rtl2 import RTL2IE from .rtp import RTPIE From dc03aa67ad6bf9ea04cf180c9d200fef07c7d5db Mon Sep 17 00:00:00 2001 From: Nick Triller Date: Wed, 20 Jul 2016 17:36:36 +0200 Subject: [PATCH 4/4] Fixed indentation in extractors package constructor (__init__.py) --- youtube_dl/extractor/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 82c3983f3..8d40862fe 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -43,4 +43,4 @@ def list_extractors(age_limit): def get_info_extractor(ie_name): """Returns the info extractor class with the given ie_name""" -return globals()[ie_name + 'IE'] \ No newline at end of file + return globals()[ie_name + 'IE'] \ No newline at end of file