2014-01-17 03:09:07 +01:00
# coding: utf-8
2014-01-15 16:48:55 +05:30
from __future__ import unicode_literals
2014-01-15 11:49:50 +05:30
from . common import InfoExtractor
2016-07-02 18:49:39 +02:00
from . . utils import (
int_or_none ,
unified_strdate ,
unified_timestamp ,
)
2014-01-17 03:09:07 +01:00
2016-07-02 18:49:39 +02:00
import re
2014-01-17 03:09:07 +01:00
2014-01-15 11:49:50 +05:30
class FranceInterIE ( InfoExtractor ) :
2016-07-02 18:49:39 +02:00
_VALID_URL = r ' https?://(?:www \ .)?franceinter \ .fr/emissions/(?P<id>[^?#]+) '
2014-01-17 03:09:07 +01:00
_TEST = {
2016-07-02 18:49:39 +02:00
' url ' : ' https://www.franceinter.fr/emissions/la-tete-au-carre/la-tete-au-carre-30-juin-2016 ' ,
' md5 ' : ' f13e4371662cf5a829f64d829ae78062 ' ,
2016-02-14 15:37:17 +06:00
' info_dict ' : {
2016-07-02 18:49:39 +02:00
' id ' : ' la-tete-au-carre/la-tete-au-carre-30-juin-2016 ' ,
2014-09-19 20:58:50 +07:00
' ext ' : ' mp3 ' ,
2016-07-02 18:49:39 +02:00
' title ' : ' Regards sur le sport du 30 juin 2016 - France Inter ' ,
' description ' : ' UEFA Europa, Jeux Olympiques... La période est aux sports, dans les gradins ou devant les écrans. Mais quel est le regard des spécialistes sur cette pratique? ' ,
' timestamp ' : 1467244800 ,
' upload_date ' : ' 20160630 ' ,
2014-01-17 03:09:07 +01:00
} ,
}
2014-01-15 11:49:50 +05:30
2014-01-17 03:09:07 +01:00
def _real_extract ( self , url ) :
2015-12-22 11:30:35 +01:00
video_id = self . _match_id ( url )
2014-01-17 03:10:54 +01:00
2014-01-17 03:09:07 +01:00
webpage = self . _download_webpage ( url , video_id )
2014-09-19 20:58:50 +07:00
2016-07-02 18:49:39 +02:00
video_url = self . _search_regex (
r ' <button class= " replay-button playable " data-is-aod= " 1 " data-url= " ([^ " ]+) " ' , webpage , ' video url ' )
2014-01-17 03:09:07 +01:00
2016-07-02 18:49:39 +02:00
title = self . _og_search_title ( webpage )
description = self . _og_search_description ( webpage )
extractdate = self . _search_regex (
r ' ([0-9]+[.][0-9]+[.][0-9]+) ' , video_url , ' extractdate ' , fatal = False )
timestamp = unified_timestamp ( extractdate )
upload_date = ( unified_strdate ( extractdate ) )
2014-09-19 20:58:50 +07:00
2014-01-17 03:09:07 +01:00
return {
' id ' : video_id ,
2014-09-19 20:58:50 +07:00
' title ' : title ,
' description ' : description ,
' timestamp ' : timestamp ,
2014-01-17 03:09:07 +01:00
' formats ' : [ {
' url ' : video_url ,
' vcodec ' : ' none ' ,
} ] ,
2016-07-02 18:49:39 +02:00
}