4 from .common
import InfoExtractor
11 class LeFigaroVideoEmbedIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://video\.lefigaro\.fr/embed/[^?#]+/(?P<id>[\w-]+)'
15 'url': 'https://video.lefigaro.fr/embed/figaro/video/les-francais-ne-veulent-ils-plus-travailler-suivez-en-direct-le-club-le-figaro-idees/',
16 'md5': 'a0c3069b7e4c4526abf0053a7713f56f',
19 'title': 'Les Français ne veulent-ils plus travailler ? Retrouvez Le Club Le Figaro Idées',
20 'description': 'md5:862b8813148ba4bf10763a65a69dfe41',
21 'upload_date': '20230216',
22 'timestamp': 1676581615,
24 'thumbnail': r
're:^https?://[^?#]+\.(?:jpeg|jpg)',
28 'url': 'https://video.lefigaro.fr/embed/figaro/video/intelligence-artificielle-faut-il-sen-mefier/',
29 'md5': '319c662943dd777bab835cae1e2d73a5',
32 'title': 'Intelligence artificielle : faut-il s’en méfier ?',
33 'description': 'md5:249d136e3e5934a67c8cb704f8abf4d2',
34 'upload_date': '20230124',
35 'timestamp': 1674584477,
37 'thumbnail': r
're:^https?://[^?#]+\.(?:jpeg|jpg)',
43 'url': 'https://video.lefigaro.fr/figaro/video/suivez-en-direct-le-club-le-figaro-international-avec-philippe-gelie-9/',
44 'md5': '6289f9489efb969e38245f31721596fe',
47 'title': 'Où en est le couple franco-allemand ? Retrouvez Le Club Le Figaro International',
48 'description': 'md5:6f47235b7e7c93b366fd8ebfa10572ac',
49 'upload_date': '20230123',
50 'timestamp': 1674503575,
52 'thumbnail': r
're:^https?://[^?#]+\.(?:jpeg|jpg)',
57 'url': 'https://video.lefigaro.fr/figaro/video/la-philosophe-nathalie-sarthou-lajus-est-linvitee-du-figaro-live/',
58 'md5': 'f6df814cae53e85937621599d2967520',
61 'title': 'La philosophe Nathalie Sarthou-Lajus est l’invitée du Figaro Live',
62 'description': 'md5:c586793bb72e726c83aa257f99a8c8c4',
63 'upload_date': '20230217',
64 'timestamp': 1676661986,
66 'thumbnail': r
're:^https?://[^?#]+\.(?:jpeg|jpg)',
72 def _real_extract(self
, url
):
73 display_id
= self
._match
_id
(url
)
74 webpage
= self
._download
_webpage
(url
, display_id
)
76 player_data
= self
._search
_nextjs
_data
(
77 webpage
, display_id
)['props']['pageProps']['initialProps']['pageData']['playerData']
79 return self
.url_result(
80 f
'jwplatform:{player_data["videoId"]}', title
=player_data
.get('title'),
81 description
=player_data
.get('description'), thumbnail
=player_data
.get('poster'))
84 class LeFigaroVideoSectionIE(InfoExtractor
):
85 _VALID_URL
= r
'https?://video\.lefigaro\.fr/figaro/(?P<id>[\w-]+)/?(?:[#?]|$)'
88 'url': 'https://video.lefigaro.fr/figaro/le-club-le-figaro-idees/',
90 'id': 'le-club-le-figaro-idees',
91 'title': 'Le Club Le Figaro Idées',
93 'playlist_mincount': 14,
95 'url': 'https://video.lefigaro.fr/figaro/factu/',
100 'playlist_mincount': 519,
105 def _get_api_response(self
, display_id
, page_num
, note
=None):
106 return self
._download
_json
(
107 'https://api-graphql.lefigaro.fr/graphql', display_id
, note
=note
,
109 'id': 'flive-website_UpdateListPage_1fb260f996bca2d78960805ac382544186b3225f5bedb43ad08b9b8abef79af6',
110 'variables': json
.dumps({
112 'videosLimit': self
._PAGE
_SIZE
,
114 'order': 'PUBLISHED_AT',
119 def _real_extract(self
, url
):
120 display_id
= self
._match
_id
(url
)
121 initial_response
= self
._get
_api
_response
(display_id
, page_num
=1)['data']['playlist']
123 def page_func(page_num
):
124 api_response
= self
._get
_api
_response
(display_id
, page_num
+ 1, note
=f
'Downloading page {page_num + 1}')
126 return [self
.url_result(
127 video
['embedUrl'], LeFigaroVideoEmbedIE
, **traverse_obj(video
, {
129 'description': 'description',
130 'thumbnail': 'thumbnailUrl',
131 })) for video
in api_response
['data']['playlist']['jsonLd'][0]['itemListElement']]
133 entries
= InAdvancePagedList(
134 page_func
, math
.ceil(initial_response
['videoCount'] / self
._PAGE
_SIZE
), self
._PAGE
_SIZE
)
136 return self
.playlist_result(entries
, playlist_id
=display_id
, playlist_title
=initial_response
.get('title'))