2016-09-09 15:49:43 -04:00
from __future__ import unicode_literals
from . common import InfoExtractor
class TVANouvellesIE ( InfoExtractor ) :
2016-09-10 19:59:56 -04:00
_VALID_URL = r ' https?://(www \ .|)tvanouvelles \ .(ca|com|qc)/.*.?/(?P<id>[^/]+) '
2016-09-09 15:49:43 -04:00
_TEST = {
' url ' : ' http://www.tvanouvelles.ca/videos/5117035533001 ' ,
' info_dict ' : {
2016-09-10 20:51:53 -04:00
' id ' : ' 5117035533001 ' ,
2016-09-09 15:49:43 -04:00
' ext ' : ' mp4 ' ,
2016-09-10 20:51:53 -04:00
' title ' : ' L \u2019 industrie du taxi d \xe9 nonce l \u2019 entente entre Qu \xe9 bec et Uber: explications ' ,
' description ' : ' L \u2019 industrie du taxi a unanimement a d \xe9 nonc \xe9 l \u2019 entente avec le gouvernement du Qu \xe9 bec qui permet \xe0 l \u2019 entreprise de covoiturage Uber de faire des affaires l \xe9 galement dans le cadre d \u2019 un projet pilote d \u2019 un an. ' ,
2016-09-09 15:49:43 -04:00
' uploader_id ' : ' 1741764581 ' ,
2016-09-10 20:51:53 -04:00
' timestamp ' : 1473352030 ,
' upload_date ' : ' 20160908 ' ,
2016-09-09 15:49:43 -04:00
} ,
' add_ie ' : [ ' BrightcoveNew ' ] ,
2016-09-10 19:59:56 -04:00
2016-09-09 15:49:43 -04:00
}
BRIGHTCOVE_URL_TEMPLATE = ' http://players.brightcove.net/1741764581/default_default/index.html?videoId= %s '
def _real_extract ( self , url ) :
program_name = self . _match_id ( url )
webpage = self . _download_webpage ( url , program_name )
brightcove_id = self . _search_regex (
2016-09-10 19:59:56 -04:00
r ' data-video-id \ =(.+[0-9]?) ' , webpage , ' brightcove id ' )
2016-09-09 15:49:43 -04:00
return self . url_result ( self . BRIGHTCOVE_URL_TEMPLATE % brightcove_id , ' BrightcoveNew ' , brightcove_id )