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