3 from .common
import InfoExtractor
13 class GediDigitalIE(InfoExtractor
):
14 _VALID_URL
= r
'''(?x:(?P<base_url>(?:https?:)//video\.
17 (?:espresso\.)?repubblica
36 )\.it(?:/[^/]+){2,4}/(?P<id>\d+))(?:$|[?&].*))'''
37 _EMBED_REGEX
= [rf
'''(?x)
42 (["'])(?P<url>{_VALID_URL})\1''']
44 'url': 'https://video.lastampa.it/politica/il-paradosso-delle-regionali-la-lega-vince-ma-sembra-aver-perso/121559/121683',
45 'md5': '84658d7fb9e55a6e57ecc77b73137494',
49 'title': 'Il paradosso delle Regionali: ecco perché la Lega vince ma sembra aver perso',
50 'description': 'md5:de7f4d6eaaaf36c153b599b10f8ce7ca',
51 'thumbnail': r
're:^https://www\.repstatic\.it/video/photo/.+?-thumb-full-.+?\.jpg$',
55 'url': 'https://video.huffingtonpost.it/embed/politica/cotticelli-non-so-cosa-mi-sia-successo-sto-cercando-di-capire-se-ho-avuto-un-malore/29312/29276?responsive=true&el=video971040871621586700',
56 'only_matching': True,
58 'url': 'https://video.espresso.repubblica.it/embed/tutti-i-video/01-ted-villa/14772/14870&width=640&height=360',
59 'only_matching': True,
61 'url': 'https://video.repubblica.it/motori/record-della-pista-a-spa-francorchamps-la-pagani-huayra-roadster-bc-stupisce/367415/367963',
62 'only_matching': True,
64 'url': 'https://video.ilsecoloxix.it/sport/cassani-e-i-brividi-azzurri-ai-mondiali-di-imola-qui-mi-sono-innamorato-del-ciclismo-da-ragazzino-incredibile-tornarci-da-ct/66184/66267',
65 'only_matching': True,
67 'url': 'https://video.iltirreno.gelocal.it/sport/dentro-la-notizia-ferrari-cosa-succede-a-maranello/141059/142723',
68 'only_matching': True,
70 'url': 'https://video.messaggeroveneto.gelocal.it/locale/maria-giovanna-elmi-covid-vaccino/138155/139268',
71 'only_matching': True,
73 'url': 'https://video.ilpiccolo.gelocal.it/dossier/big-john/dinosauro-big-john-al-via-le-visite-guidate-a-trieste/135226/135751',
74 'only_matching': True,
76 'url': 'https://video.gazzettadimantova.gelocal.it/locale/dal-ponte-visconteo-di-valeggio-l-and-8217sos-dei-ristoratori-aprire-anche-a-cena/137310/137818',
77 'only_matching': True,
79 'url': 'https://video.mattinopadova.gelocal.it/dossier/coronavirus-in-veneto/covid-a-vo-un-anno-dopo-un-cuore-tricolore-per-non-dimenticare/138402/138964',
80 'only_matching': True,
82 'url': 'https://video.laprovinciapavese.gelocal.it/locale/mede-zona-rossa-via-alle-vaccinazioni-per-gli-over-80/137545/138120',
83 'only_matching': True,
85 'url': 'https://video.tribunatreviso.gelocal.it/dossier/coronavirus-in-veneto/ecco-le-prima-vaccinazioni-di-massa-nella-marca/134485/135024',
86 'only_matching': True,
88 'url': 'https://video.nuovavenezia.gelocal.it/locale/camion-troppo-alto-per-il-ponte-ferroviario-perde-il-carico/135734/136266',
89 'only_matching': True,
91 'url': 'https://video.gazzettadimodena.gelocal.it/locale/modena-scoperta-la-proteina-che-predice-il-livello-di-gravita-del-covid/139109/139796',
92 'only_matching': True,
94 'url': 'https://video.lanuovaferrara.gelocal.it/locale/due-bombole-di-gpl-aperte-e-abbandonate-i-vigili-bruciano-il-gas/134391/134957',
95 'only_matching': True,
97 'url': 'https://video.corrierealpi.gelocal.it/dossier/cortina-2021-i-mondiali-di-sci-alpino/mondiali-di-sci-il-timelapse-sulla-splendida-olympia/133760/134331',
98 'only_matching': True,
100 'url': 'https://video.lasentinella.gelocal.it/locale/vestigne-centra-un-auto-e-si-ribalta/138931/139466',
101 'only_matching': True,
103 'url': 'https://video.espresso.repubblica.it/tutti-i-video/01-ted-villa/14772',
104 'only_matching': True,
108 def _sanitize_urls(urls
):
109 # add protocol if missing
110 for i
, e
in enumerate(urls
):
111 if e
.startswith('//'):
112 urls
[i
] = f
'https:{e}'
114 for i
, e
in enumerate(urls
):
115 urls
[i
] = urljoin(base_url(e
), url_basename(e
))
119 def _extract_embed_urls(cls
, url
, webpage
):
120 return cls
._sanitize
_urls
(tuple(super()._extract
_embed
_urls
(url
, webpage
)))
123 def _clean_formats(formats
):
127 if f
['url'] not in format_urls
:
128 if f
.get('audio_ext') != 'none' and not f
.get('acodec'):
130 format_urls
.add(f
['url'])
131 clean_formats
.append(f
)
132 formats
[:] = clean_formats
134 def _real_extract(self
, url
):
135 video_id
, url
= self
._match
_valid
_url
(url
).group('id', 'base_url')
136 webpage
= self
._download
_webpage
(url
, video_id
)
137 title
= self
._html
_search
_meta
(
138 ['twitter:title', 'og:title'], webpage
, fatal
=True)
139 player_data
= re
.findall(
140 r
"PlayerFactory\.setParam\('(?P<type>format|param)',\s*'(?P<name>[^']+)',\s*'(?P<val>[^']+)'\);",
144 duration
= thumb
= None
145 for t
, n
, v
in player_data
:
147 if n
in ('video-hds-vod-ec', 'video-hls-vod-ec', 'video-viralize', 'video-youtube-pfp'):
149 elif n
.endswith('-vod-ak'):
150 formats
.extend(self
._extract
_akamai
_formats
(
151 v
, video_id
, {'http': 'media.gedidigital.it'}))
153 ext
= determine_ext(v
)
155 formats
.extend(self
._extract
_m
3u8_formats
(
156 v
, video_id
, 'mp4', 'm3u8_native', m3u8_id
=n
, fatal
=False))
163 abr
= int_or_none(self
._search
_regex
(
164 r
'-mp3-audio-(\d+)', v
, 'abr', default
=None))
172 mobj
= re
.match(r
'^video-rrtv-(\d+)(?:-(\d+))?$', n
)
175 'height': int(mobj
.group(1)),
176 'vbr': int_or_none(mobj
.group(2)),
179 f
['vbr'] = int_or_none(self
._search
_regex
(
180 r
'-video-rrtv-(\d+)', v
, 'abr', default
=None))
183 if n
in ['image_full', 'image']:
185 elif n
== 'videoDuration':
186 duration
= int_or_none(v
)
188 self
._clean
_formats
(formats
)
193 'description': self
._html
_search
_meta
(
194 ['twitter:description', 'og:description', 'description'], webpage
),
195 'thumbnail': thumb
or self
._og
_search
_thumbnail
(webpage
),
197 'duration': duration
,