]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/kankanews.py
7 from .common
import InfoExtractor
10 class KankaNewsIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?kankanews\.com/a/\d+\-\d+\-\d+/(?P<id>\d+)\.shtml'
13 'url': 'https://www.kankanews.com/a/2022-11-08/00310276054.shtml?appid=1088227',
14 'md5': '05e126513c74b1258d657452a6f4eef9',
17 'url': 'http://mediaplay.kksmg.com/2022/11/08/h264_450k_mp4_1a388ad771e0e4cc28b0da44d245054e_ncm.mp4',
19 'title': '视频|第23个中国记者节,我们在进博切蛋糕',
20 'thumbnail': r
're:^https?://.*\.jpg*',
24 def _real_extract(self
, url
):
25 display_id
= self
._match
_id
(url
)
26 webpage
= self
._download
_webpage
(url
, display_id
)
27 video_id
= self
._search
_regex
(r
'omsid\s*=\s*"(\d+)"', webpage
, 'video id')
30 'nonce': ''.join(random
.choices(string
.ascii_lowercase
+ string
.digits
, k
=8)),
33 'timestamp': int(time
.time()),
36 params
['sign'] = hashlib
.md5((hashlib
.md5((
37 urllib
.parse
.urlencode(params
) + '&28c8edde3d61a0411511d3b1866f0636'
38 ).encode()).hexdigest()).encode()).hexdigest()
40 meta
= self
._download
_json
('https://api-app.kankanews.com/kankan/pc/getvideo',
41 video_id
, query
=params
)['result']['video']
45 'url': meta
['videourl'],
46 'title': self
._search
_regex
(r
'g\.title\s*=\s*"([^"]+)"', webpage
, 'title'),
47 'thumbnail': meta
.get('titlepic'),