2016-07-02 09:49:03 -06:00
# coding: utf-8
2014-01-26 23:05:28 -07:00
from __future__ import unicode_literals
from . common import InfoExtractor
from . . utils import (
2016-07-04 10:59:03 -06:00
smuggle_url ,
2014-01-26 23:05:28 -07:00
)
class LA7IE ( InfoExtractor ) :
2016-07-02 09:49:03 -06:00
IE_NAME = ' la7.it '
_VALID_URL = r ''' (?x)(https?://)?(?:
( ? : www \. ) ? la7 \. it / ( [ ^ / ] + ) / ( ? : rivedila7 | video ) / |
tg \. la7 \. it / repliche - tgla7 \? id =
) ( ? P < id > . + ) '''
_TESTS = [ {
# 'src' is a plain URL
' url ' : ' http://www.la7.it/crozza/video/inccool8-02-10-2015-163722 ' ,
2016-07-04 10:59:03 -06:00
' md5 ' : ' 8b613ffc0c4bf9b9e377169fc19c214c ' ,
2016-07-02 09:49:03 -06:00
' info_dict ' : {
2019-10-28 08:17:06 -06:00
' id ' : ' 0_42j6wd36 ' ,
2016-07-02 09:49:03 -06:00
' ext ' : ' mp4 ' ,
' title ' : ' Inc.Cool8 ' ,
2020-01-05 09:29:51 -07:00
' description ' : ' Benvenuti nell \' incredibile mondo della INC. COOL. 8. dove “INC.” sta per “Incorporated” “COOL” sta per “fashion” ed Eight sta per il gesto atletico ' ,
2016-07-02 09:49:03 -06:00
' thumbnail ' : ' re:^https?://.* ' ,
2016-07-04 10:59:03 -06:00
' uploader_id ' : ' kdla7pillole@iltrovatore.it ' ,
' timestamp ' : 1443814869 ,
' upload_date ' : ' 20151002 ' ,
2016-07-02 09:49:03 -06:00
} ,
} , {
' url ' : ' http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077 ' ,
' only_matching ' : True ,
} ]
2014-01-26 23:05:28 -07:00
def _real_extract ( self , url ) :
2015-02-01 07:03:03 -07:00
video_id = self . _match_id ( url )
2016-07-02 09:49:03 -06:00
2020-11-04 10:14:02 -07:00
if not url . startswith ( ' http ' ) :
url = ' %s // %s ' % ( self . http_scheme ( ) , url )
2016-07-02 09:49:03 -06:00
webpage = self . _download_webpage ( url , video_id )
2020-01-05 09:29:51 -07:00
player_data = self . _search_regex (
[ r ' (?s)videoParams \ s*= \ s*( { .+?}); ' , r ' videoLa7 \ (( { [^;]+}) \ ); ' ] ,
webpage , ' player data ' )
vid = self . _search_regex ( r ' vid \ s*: \ s* " (.+?) " , ' , player_data , ' vid ' )
2016-07-02 09:49:03 -06:00
2014-01-26 23:05:28 -07:00
return {
2016-07-04 10:59:03 -06:00
' _type ' : ' url_transparent ' ,
2020-01-05 09:29:51 -07:00
' url ' : smuggle_url ( ' kaltura:103: %s ' % vid , {
2019-10-28 08:17:06 -06:00
' service_url ' : ' http://nkdam.iltrovatore.it ' ,
2016-07-04 10:59:03 -06:00
} ) ,
2014-01-26 23:05:28 -07:00
' id ' : video_id ,
2020-01-05 09:29:51 -07:00
' title ' : self . _og_search_title ( webpage , default = None ) ,
2016-07-02 09:49:03 -06:00
' description ' : self . _og_search_description ( webpage , default = None ) ,
2020-01-05 09:29:51 -07:00
' thumbnail ' : self . _og_search_thumbnail ( webpage , default = None ) ,
2016-07-04 10:59:03 -06:00
' ie_key ' : ' Kaltura ' ,
2014-01-26 23:05:28 -07:00
}