2013-12-17 05:34:41 +09:00
# coding: utf-8
import re
from . common import InfoExtractor
class RadioFranceIE ( InfoExtractor ) :
_VALID_URL = r ' ^https?://maison \ .radiofrance \ .fr/radiovisions/(?P<id>[^?#]+) '
IE_NAME = u ' radiofrance '
_TEST = {
u ' url ' : u ' http://maison.radiofrance.fr/radiovisions/one-one ' ,
2013-12-17 07:07:57 +09:00
u ' file ' : u ' one-one.ogg ' ,
u ' md5 ' : u ' bdbb28ace95ed0e04faab32ba3160daf ' ,
2013-12-17 05:34:41 +09:00
u ' info_dict ' : {
u " title " : u " One to one " ,
u " description " : u " Plutôt que d ' imaginer la radio de demain comme technologie ou comme création de contenu, je veux montrer que quelles que soient ses évolutions, j ' ai l ' intime conviction que la radio continuera d ' être un grand média de proximité pour les auditeurs. " ,
2013-12-17 07:07:57 +09:00
u " uploader " : u " Thomas Hercouët " ,
2013-12-17 05:34:41 +09:00
} ,
}
def _real_extract ( self , url ) :
m = re . match ( self . _VALID_URL , url )
video_id = m . group ( ' id ' )
webpage = self . _download_webpage ( url , video_id )
title = self . _html_search_regex ( r ' <h1>(.*?)</h1> ' , webpage , u ' title ' )
description = self . _html_search_regex (
r ' <div class= " bloc_page_wrapper " ><div class= " text " >(.*?)</div> ' ,
webpage , u ' description ' , fatal = False )
uploader = self . _html_search_regex (
r ' <div class= " credit " > © (.*?)</div> ' ,
webpage , u ' uploader ' , fatal = False )
formats_str = self . _html_search_regex (
r ' class= " jp-jplayer[^ " ]* " data-source= " ([^ " ]+) " > ' ,
webpage , u ' audio URLs ' )
formats = [
{
2013-12-17 20:35:16 +09:00
' format_id ' : fm [ 0 ] ,
' url ' : fm [ 1 ] ,
2013-12-17 05:34:41 +09:00
' vcodec ' : ' none ' ,
}
2013-12-17 20:35:16 +09:00
for fm in
2013-12-17 05:34:41 +09:00
re . findall ( r " ([a-z0-9]+) \ s*: \ s* ' ([^ ' ]+) ' " , formats_str )
]
# No sorting, we don't know any more about these formats
return {
' id ' : video_id ,
' title ' : title ,
' formats ' : formats ,
' description ' : description ,
' uploader ' : uploader ,
}