]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/la7.py
3 from . common
import InfoExtractor
13 class LA7IE ( InfoExtractor
):
15 _VALID_URL
= r
'''(?x)https?://(?:
16 (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video|news)/|
17 tg\.la7\.it/repliche-tgla7\?id=
21 # single quality video
22 'url' : 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722' ,
23 'md5' : '8b613ffc0c4bf9b9e377169fc19c214c' ,
25 'id' : 'inccool8-02-10-2015-163722' ,
28 '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' ,
29 'thumbnail' : 're:^https?://.*' ,
30 'upload_date' : '20151002' ,
34 # multiple quality video
35 'url' : 'https://www.la7.it/calcio-femminile/news/il-gol-di-lindsey-thomas-fiorentina-vs-milan-serie-a-calcio-femminile-26-11-2022-461736' ,
36 'md5' : 'd2370e78f75e8d1238cb3a0db9a2eda3' ,
38 'id' : 'il-gol-di-lindsey-thomas-fiorentina-vs-milan-serie-a-calcio-femminile-26-11-2022-461736' ,
40 'title' : 'Il gol di Lindsey Thomas | Fiorentina vs Milan | Serie A Calcio Femminile' ,
41 'description' : 'Il gol di Lindsey Thomas | Fiorentina vs Milan | Serie A Calcio Femminile' ,
42 'thumbnail' : 're:^https?://.*' ,
43 'upload_date' : '20221126' ,
47 'url' : 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077' ,
48 'only_matching' : True ,
50 _HOST
= 'https://awsvodpkg.iltrovatore.it'
52 def _generate_mp4_url ( self
, quality
, m3u8_formats
):
53 for f
in m3u8_formats
:
54 if f
[ 'vcodec' ] != 'none' and quality
in f
[ 'url' ]:
55 http_url
= f
' {self._HOST}{quality} .mp4'
57 urlh
= self
._ request
_ webpage
(
58 HEADRequest ( http_url
), quality
,
59 note
= 'Check filesize' , fatal
= False )
62 del http_f
[ 'manifest_url' ]
64 'format_id' : http_f
[ 'format_id' ]. replace ( 'hls-' , 'https-' ),
67 'filesize_approx' : int_or_none ( urlh
. headers
. get ( 'Content-Length' , None )),
72 def _real_extract ( self
, url
):
73 video_id
= self
._ match
_ id
( url
)
74 webpage
= self
._ download
_ webpage
( url
, video_id
)
76 if re
. search ( r
'(?i)(drmsupport\s*:\s*true)\s*' , webpage
):
77 self
. report_drm ( video_id
)
79 video_path
= self
._ search
_ regex
(
80 r
'(/content/[\w/,]+?)\.mp4(?:\.csmil)?/master\.m3u8' , webpage
, 'video_path' )
82 formats
= self
._ extract
_ mpd
_ formats
(
83 f
' {self._HOST} /local/dash/, {video_path} .mp4.urlset/manifest.mpd' ,
84 video_id
, mpd_id
= 'dash' , fatal
= False )
85 m3u8_formats
= self
._ extract
_ m
3u8_ formats
(
86 f
' {self._HOST} /local/hls/, {video_path} .mp4.urlset/master.m3u8' ,
87 video_id
, 'mp4' , m3u8_id
= 'hls' , fatal
= False )
88 formats
. extend ( m3u8_formats
)
90 for q
in filter ( None , video_path
. split ( ',' )):
91 http_f
= self
._ generate
_ mp
4_u rl
( q
, m3u8_formats
)
93 formats
. append ( http_f
)
97 'title' : self
._ og
_ search
_ title
( webpage
, default
= None ),
98 'description' : self
._ og
_ search
_ description
( webpage
, default
= None ),
99 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
, default
= None ),
101 'upload_date' : unified_strdate ( self
._ search
_ regex
( r
'datetime="(.+?)"' , webpage
, 'upload_date' , fatal
= False ))
105 class LA7PodcastEpisodeIE ( InfoExtractor
):
106 IE_NAME
= 'la7.it:pod:episode'
107 _VALID_URL
= r
'https?://(?:www\.)?la7\.it/[^/]+/podcast/([^/]+-)?(?P<id>\d+)'
110 'url' : 'https://www.la7.it/voicetown/podcast/la-carezza-delle-memoria-di-carlo-verdone-23-03-2021-371497' ,
111 'md5' : '7737d4d79b3c1a34b3de3e16297119ed' ,
115 'title' : '"La carezza delle memoria" di Carlo Verdone' ,
116 'description' : 'md5:5abf07c3c551a687db80af3f9ceb7d52' ,
117 'thumbnail' : 'https://www.la7.it/sites/default/files/podcast/371497.jpg' ,
118 'upload_date' : '20210323' ,
122 'url' : 'https://www.la7.it/embed/podcast/371497' ,
123 'only_matching' : True ,
125 # date already in the title
126 'url' : 'https://www.la7.it/propagandalive/podcast/lintervista-di-diego-bianchi-ad-annalisa-cuzzocrea-puntata-del-1932021-20-03-2021-371130' ,
127 'only_matching' : True ,
129 # title same as show_title
130 'url' : 'https://www.la7.it/otto-e-mezzo/podcast/otto-e-mezzo-26-03-2021-372340' ,
131 'only_matching' : True ,
134 def _extract_info ( self
, webpage
, video_id
= None , ppn
= None ):
136 video_id
= self
._ search
_ regex
(
137 r
'data-nid=([\' "])(?P<vid>\d+)\1',
138 webpage, 'video_id', group='vid')
140 media_url = self._search_regex(
141 (r'src\s*:\s*([ \' " ])( ?P
< url
> \S
+ ?mp3
.+ ?
) \
1 ',
142 r' data
- podcast\s
*= \s
*([ \' "])(?P<url>\S+?mp3.+?)\1'),
143 webpage, 'media_url', group='url')
146 'format_id': 'http-mp3',
152 title = self._html_search_regex(
153 (r'<div class=" title
">(?P<title>.+?)</',
154 r'<title>(?P<title>[^<]+)</title>',
155 r'title:\s*([ \' " ])( ?P
< title
>.+ ?
) \
1 '),
156 webpage, ' title
', group=' title
')
159 self._html_search_regex(
160 (r' < div
class = "description" >(.+ ?
)</ div
> ',
161 r' < div
class = "description-mobile" >(.+ ?
)</ div
> ',
162 r' < div
class = "box-txt" >([ ^
<]+ ?
)</ div
> ',
163 r' < div
class = "field-content" >< p
>(.+ ?
)</ p
></ div
> '),
164 webpage, ' description
', default=None)
165 or self._html_search_meta(' description
', webpage))
167 thumb = self._html_search_regex(
168 (r' < div
class = "podcast-image" >< img src
= "(.+?)" ></ div
> ',
169 r' < div
class = "container-embed" [ ^
<]+ url\
((.+ ?
) \
); ">',
170 r'<div class=" field
- content
"><img src=" (.+ ?
) "'),
171 webpage, 'thumbnail', fatal=False, default=None)
173 duration = parse_duration(self._html_search_regex(
174 r'<span class=" ( ?
: durata|duration
) ">([\d:]+)</span>',
175 webpage, 'duration', fatal=False, default=None))
177 date = self._html_search_regex(
178 r'class=" data
">\s*(?:<span>)?([\d\.]+)\s*</',
179 webpage, 'date', default=None)
181 date_alt = self._search_regex(
182 r'(\d+[\./]\d+[\./]\d+)', title, 'date_alt', default=None)
183 ppn = ppn or self._search_regex(
184 r'ppN:\s*([ \' " ])( ?P
< ppn
>.+ ?
) \
1 ',
185 webpage, ' ppn
', group=' ppn
', default=None)
186 # if the date is not in the title
187 # and title is the same as the show_title
188 # add the date to the title
189 if date and not date_alt and ppn and ppn.lower() == title.lower():
190 title = f' {title}
del {date}
'
194 ' description
': description,
195 ' duration
': float_or_none(duration),
198 ' upload_date
': unified_strdate(date),
201 def _real_extract(self, url):
202 video_id = self._match_id(url)
203 webpage = self._download_webpage(url, video_id)
205 return self._extract_info(webpage, video_id)
208 class LA7PodcastIE(LA7PodcastEpisodeIE): # XXX: Do not subclass from concrete IE
209 IE_NAME = ' la7
. it
: podcast
'
210 _VALID_URL = r' https?
://( ?
: www\
.) ?la7\
. it
/( ?P
< id >[ ^
/]+)/ podcast
/ ?
( ?
: $|
[ #?])'
213 'url' : 'https://www.la7.it/propagandalive/podcast' ,
215 'id' : 'propagandalive' ,
216 'title' : "Propaganda Live" ,
218 'playlist_count_min' : 10 ,
221 def _real_extract ( self
, url
):
222 playlist_id
= self
._ match
_ id
( url
)
223 webpage
= self
._ download
_ webpage
( url
, playlist_id
)
226 self
._ html
_ search
_ regex
(
227 r
'<h1.*?>(.+?)</h1>' , webpage
, 'title' , fatal
= False , default
= None )
228 or self
._ og
_ search
_ title
( webpage
))
229 ppn
= self
._ search
_ regex
(
230 r
'window\.ppN\s*=\s*([\' "])(?P<ppn>.+?)\1',
231 webpage, 'ppn', group='ppn', default=None)
234 for episode in re.finditer(
235 r'<div class=" container
- podcast
- property ">([\s\S]+?)(?:</div>\s*) {3} ',
237 entries.append(self._extract_info(episode.group(1), ppn=ppn))
239 return self.playlist_result(entries, playlist_id, title)