]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/la7.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
16 class LA7IE ( InfoExtractor
):
18 _VALID_URL
= r
'''(?x)(https?://)?(?:
19 (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video)/|
20 tg\.la7\.it/repliche-tgla7\?id=
24 # 'src' is a plain URL
25 'url' : 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722' ,
26 'md5' : '8b613ffc0c4bf9b9e377169fc19c214c' ,
31 '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' ,
32 'thumbnail' : 're:^https?://.*' ,
33 'uploader_id' : 'kdla7pillole@iltrovatore.it' ,
34 'timestamp' : 1443814869 ,
35 'upload_date' : '20151002' ,
38 'url' : 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077' ,
39 'only_matching' : True ,
42 def _real_extract ( self
, url
):
43 video_id
= self
._ match
_ id
( url
)
45 if not url
. startswith ( 'http' ):
46 url
= ' %s // %s ' % ( self
. http_scheme (), url
)
48 webpage
= self
._ download
_ webpage
( url
, video_id
)
50 player_data
= self
._ search
_ regex
(
51 [ r
'(?s)videoParams\s*=\s*( {.+?} );' , r
'videoLa7\(( {[^;]+} )\);' ],
52 webpage
, 'player data' )
53 vid
= self
._ search
_ regex
( r
'vid\s*:\s*"(.+?)",' , player_data
, 'vid' )
56 '_type' : 'url_transparent' ,
57 'url' : smuggle_url ( 'kaltura:103: %s ' % vid
, {
58 'service_url' : 'http://nkdam.iltrovatore.it' ,
61 'title' : self
._ og
_ search
_ title
( webpage
, default
= None ),
62 'description' : self
._ og
_ search
_ description
( webpage
, default
= None ),
63 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
, default
= None ),
68 class LA7PodcastEpisodeIE ( InfoExtractor
):
69 IE_NAME
= 'la7.it:pod:episode'
70 _VALID_URL
= r
'''(?x)(https?://)?
71 (?:www\.)?la7\.it/[^/]+/podcast/([^/]+-)?(?P<id>\d+)'''
74 'url' : 'https://www.la7.it/voicetown/podcast/la-carezza-delle-memoria-di-carlo-verdone-23-03-2021-371497' ,
75 'md5' : '7737d4d79b3c1a34b3de3e16297119ed' ,
79 'title' : '"La carezza delle memoria" di Carlo Verdone' ,
80 'description' : 'md5:5abf07c3c551a687db80af3f9ceb7d52' ,
81 'thumbnail' : 'https://www.la7.it/sites/default/files/podcast/371497.jpg' ,
82 'upload_date' : '20210323' ,
86 'url' : 'https://www.la7.it/embed/podcast/371497' ,
87 'only_matching' : True ,
89 # date already in the title
90 'url' : 'https://www.la7.it/propagandalive/podcast/lintervista-di-diego-bianchi-ad-annalisa-cuzzocrea-puntata-del-1932021-20-03-2021-371130' ,
91 'only_matching' : True ,
93 # title same as show_title
94 'url' : 'https://www.la7.it/otto-e-mezzo/podcast/otto-e-mezzo-26-03-2021-372340' ,
95 'only_matching' : True ,
98 def _extract_info ( self
, webpage
, video_id
= None , ppn
= None ):
100 video_id
= self
._ search
_ regex
(
101 r
'data-nid=([\' "])(?P<vid>\d+)\1',
102 webpage, 'video_id', group='vid')
104 media_url = self._search_regex(
105 (r'src:\s*([ \' " ])( ?P
< url
>.+ ?mp3
.+ ?
) \
1 ',
106 r' data
- podcast
=([ \' "])(?P<url>.+?mp3.+?)\1'),
107 webpage, 'media_url', group='url')
108 ext = determine_ext(media_url)
114 self._sort_formats(formats)
116 title = self._html_search_regex(
117 (r'<div class=" title
">(?P<title>.+?)</',
118 r'<title>(?P<title>[^<]+)</title>',
119 r'title:\s*([ \' " ])( ?P
< title
>.+ ?
) \
1 '),
120 webpage, ' title
', group=' title
')
123 self._html_search_regex(
124 (r' < div
class = "description" >(.+ ?
)</ div
> ',
125 r' < div
class = "description-mobile" >(.+ ?
)</ div
> ',
126 r' < div
class = "box-txt" >([ ^
<]+ ?
)</ div
> ',
127 r' < div
class = "field-content" >< p
>(.+ ?
)</ p
></ div
> '),
128 webpage, ' description
', default=None)
129 or self._html_search_meta(' description
', webpage))
131 thumb = self._html_search_regex(
132 (r' < div
class = "podcast-image" >< img src
= "(.+?)" ></ div
> ',
133 r' < div
class = "container-embed" [ ^
<]+ url\
((.+ ?
) \
); ">',
134 r'<div class=" field
- content
"><img src=" (.+ ?
) "'),
135 webpage, 'thumbnail', fatal=False, default=None)
137 duration = parse_duration(self._html_search_regex(
138 r'<span class=" ( ?
: durata|duration
) ">([\d:]+)</span>',
139 webpage, 'duration', fatal=False, default=None))
141 date = self._html_search_regex(
142 r'class=" data
">\s*(?:<span>)?([\d\.]+)\s*</',
143 webpage, 'date', default=None)
145 date_alt = self._search_regex(
146 r'(\d+[\./]\d+[\./]\d+)', title, 'date_alt', default=None)
147 ppn = ppn or self._search_regex(
148 r'ppN:\s*([ \' " ])( ?P
< ppn
>.+ ?
) \
1 ',
149 webpage, ' ppn
', group=' ppn
', default=None)
150 # if the date is not in the title
151 # and title is the same as the show_title
152 # add the date to the title
153 if date and not date_alt and ppn and ppn.lower() == title.lower():
154 title += ' del %s ' % date
158 ' description
': description,
159 ' duration
': float_or_none(duration),
162 ' upload_date
': unified_strdate(date),
165 def _real_extract(self, url):
166 video_id = self._match_id(url)
167 webpage = self._download_webpage(url, video_id)
169 return self._extract_info(webpage, video_id)
172 class LA7PodcastIE(LA7PodcastEpisodeIE):
173 IE_NAME = ' la7
. it
: podcast
'
174 _VALID_URL = r' ( https?
://) ?
( www\
.) ?la7\
. it
/( ?P
< id >[ ^
/]+)/ podcast
/ ?
( ?
: $|
[ #?])'
177 'url' : 'https://www.la7.it/propagandalive/podcast' ,
179 'id' : 'propagandalive' ,
180 'title' : "Propaganda Live" ,
182 'playlist_count' : 10 ,
185 def _real_extract ( self
, url
):
186 playlist_id
= self
._ match
_ id
( url
)
187 webpage
= self
._ download
_ webpage
( url
, playlist_id
)
190 self
._ html
_ search
_ regex
(
191 r
'<h1.*?>(.+?)</h1>' , webpage
, 'title' , fatal
= False , default
= None )
192 or self
._ og
_ search
_ title
( webpage
))
193 ppn
= self
._ search
_ regex
(
194 r
'window\.ppN\s*=\s*([\' "])(?P<ppn>.+?)\1',
195 webpage, 'ppn', group='ppn', default=None)
198 for episode in re.finditer(
199 r'<div class=" container
- podcast
- property ">([\s\S]+?)(?:</div>\s*) {3} ',
201 entries.append(self._extract_info(episode.group(1), ppn=ppn))
203 return self.playlist_result(entries, playlist_id, title)