From ebab62b506604cd11afb429b96426db5f99613e3 Mon Sep 17 00:00:00 2001 From: trson Date: Mon, 13 Feb 2017 23:04:28 +0100 Subject: [PATCH] [RaiPlay] Add support for raiplay.it URLs Add to rai.py the RaiPlayIE class (modeled after RaiTVIE) to support URLs for the new raiplay.it website. --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/rai.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 76ad7c40b..fdd89ca12 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -779,6 +779,7 @@ from .radiofrance import RadioFranceIE from .rai import ( RaiTVIE, RaiIE, + RaiPlayIE, ) from .rbmaradio import RBMARadioIE from .rds import RDSIE diff --git a/youtube_dl/extractor/rai.py b/youtube_dl/extractor/rai.py index 41afbd9af..e9a478de2 100644 --- a/youtube_dl/extractor/rai.py +++ b/youtube_dl/extractor/rai.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import unicode_literals from .common import InfoExtractor @@ -265,3 +266,23 @@ class RaiIE(RaiBaseIE): 'title': title, 'formats': formats, } + +class RaiPlayIE(RaiBaseIE): + _VALID_URL = r'https?://(?:.+?\.)?raiplay\.it/raiplay/video/(?:[^/]+/)+.+?-(?P[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})(?:-.+?)?\.html' + _TEST = { + 'url': 'http://www.raiplay.it/raiplay/video/2016/06/Paolo-Fresu-Il-tempo-di-un-viaggio-5bdc6f5f-74b7-426e-8192-9a1189123522.html', + 'info_dict': { + 'id': '5bdc6f5f-74b7-426e-8192-9a1189123522', + 'ext': 'mp4', + 'title': '365 Paolo Fresu, il tempo di un viaggio', + 'description': 'Incontro con con Paolo Fresu, compositore e trombettista di straordinario e talento. Dall\'attaccamento alla terra della nativa Sardegna alle prime avventure musicali, dalla passione per Miles Davis alle collaborazioni con autori e musicisti di ogni nazionalità e estrazione.', + 'upload_date': '20160628', + 'duration': 6014.0, + 'thumbnail': r're:^https?://.*\.jpg$', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + return self._extract_from_content_id(video_id, url)