]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/unscripted.py
1 from .common
import InfoExtractor
2 from ..utils
import parse_duration
, traverse_obj
5 class UnscriptedNewsVideoIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://www\.unscripted\.news/videos/(?P<id>[\w-]+)'
8 'url': 'https://www.unscripted.news/videos/a-day-at-the-farmers-protest',
10 'id': '60c0a55cd1e99b1079918a57',
11 'display_id': 'a-day-at-the-farmers-protest',
13 'title': 'A Day at the Farmers\' Protest',
14 'description': 'md5:4b3df22747a03e8f14f746dd72190384',
15 'thumbnail': 'https://s3.unscripted.news/anj2/60c0a55cd1e99b1079918a57/5f199a65-c803-4a5c-8fce-2077359c3b72.jpg',
17 'series': 'Ground Reports',
20 'url': 'https://www.unscripted.news/videos/you-get-the-politicians-you-deserve-ft-shashi-tharoor',
22 'id': '5fb3afbf18ac817d341a74d8',
23 'display_id': 'you-get-the-politicians-you-deserve-ft-shashi-tharoor',
25 'cast': ['Avalok Langer', 'Ashwin Mehta'],
26 'thumbnail': 'https://s3.unscripted.news/anj2/5fb3afbf18ac817d341a74d8/82bd7942-4f20-4cd8-98ae-83f9e814f998.jpg',
27 'description': 'md5:1e91b069238a705ca3a40f87e6f1182c',
29 'series': 'Dumb Questions Only',
30 'title': 'You Get The Politicians You Deserve! ft. Shashi Tharoor',
34 def _real_extract(self
, url
):
35 display_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, display_id
)
37 nextjs_data
= self
._search
_nextjs
_data
(webpage
, display_id
)['props']['pageProps']['dataLocal']
39 # TODO: get subtitle from srt key
40 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(nextjs_data
['alt_content'], display_id
)
43 'id': nextjs_data
['_id'],
44 'display_id': display_id
,
45 'title': nextjs_data
.get('title') or self
._og
_search
_title
(webpage
),
46 'description': nextjs_data
.get('sh_heading') or self
._og
_search
_description
(webpage
),
48 'subtitles': subtitles
,
49 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
50 'duration': parse_duration(nextjs_data
.get('duration')),
51 'series': traverse_obj(nextjs_data
, ('show', 'topic')),
52 'cast': traverse_obj(nextjs_data
, ('cast_crew', ..., 'displayname')),