]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/newsy.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class NewsyIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?newsy\.com/stories/(?P<id>[^/?#$&]+)'
15 'url': 'https://www.newsy.com/stories/nft-trend-leads-to-fraudulent-art-auctions/',
17 'id': '609d65125b086c24fb529312',
19 'title': 'NFT Art Auctions Have A Piracy Problem',
20 'description': 'md5:971e52ab8bc97e50305475cde8284c83',
21 'display_id': 'nft-trend-leads-to-fraudulent-art-auctions',
22 'timestamp': 1621339200,
24 'thumbnail': 'https://cdn.newsy.com/images/videos/x/1620927824_xyrrP4.jpg',
25 'upload_date': '20210518'
27 'params': {'skip_download': True}
30 def _real_extract(self
, url
):
31 display_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, display_id
)
33 data_json
= self
._parse
_json
(self
._html
_search
_regex
(
34 r
'data-video-player\s?=\s?"({[^"]+})">', webpage
, 'data'), display_id
, js_to_json
)
35 ld_json
= self
._search
_json
_ld
(webpage
, display_id
, fatal
=False)
37 formats
, subtitles
= [], {}
38 if data_json
.get('stream'):
39 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(data_json
['stream'], display_id
)
41 subtitles
= self
._merge
_subtitles
(subtitles
, subs
)
42 self
._sort
_formats
(formats
)
43 return merge_dicts(ld_json
, {
44 'id': data_json
['id'],
45 'display_id': display_id
,
46 'title': data_json
.get('headline'),
47 'duration': data_json
.get('duration'),
48 'thumbnail': data_json
.get('image'),
50 'subtitles': subtitles
,