import requests
import execjs
for i in range(4):
i = i+1
url = 'https://vipapi.qimingpian.cn/Activity/channelInformationByChannelName'
data = {
'channel_name': ' 24新声',
'page': f'{i}',
'num': ' 20',
'unionid': ' W9wLD4rHIZrB3GLTUn+cmHgbZcEepR78xJa5Zit6+XTMtata86DehdxDt/fDbcHeeJWqqIs6kiQsM8IbOYgM5A==',
}
headers = {
"Accept":"application/json, text/plain, */*",
"Accept-Encoding":"gzip, deflate, br, zstd",
"Accept-Language":"zh-CN,zh;q=0.9",
"Cache-Control":"no-cache",
"Connection":"keep-alive",
"Content-Length":"154",
"Content-Type":"application/x-www-form-urlencoded",
"Host":"vipapi.qimingpian.cn",
"Origin":"https://www.qimingpian.com",
"Pragma":"o-cache",
"Sec-Ch-Ua":'"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
"Sec-Ch-Ua-Mobile":"?0",
"Sec-Ch-Ua-Platform":'"Windows"',
"Sec-Fetch-Dest":"empty",
"Sec-Fetch-Mode":"cors",
"Sec-Fetch-Site":"cross-site",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
}
response = requests.post(url=url,json=data,headers=headers).json()
encrypt_data = response['encrypt_data']
print(i)
print(encrypt_data)
dery_data = execjs.compile(open('.\demo.js','r',encoding='utf-8').read()).call('s',encrypt_data)
for content in dery_data['list']:
title = content['content']
create_time = content['create_time']
link_url = content['link_url']
news_id = content['news_id']
news_type = content['news_type']
news_abstract = content['news_abstract']
print(title,create_time,link_url,news_id,news_type,news_abstract)
print('-------------------------------------------------------------')
Javascript 部分代码(都是从网页上复制来的):
function o(e, t, i, n, a, o) {
var s, c, r, l, d, u, h, p, f, m, v, g, y, b,
C = new Array(16843776, 0, 65536, 16843780, 16842756, 66564, 4, 65536, 1024, 16843776, 16843780, 1024, 16778244, 16842756, 16777216, 4, 1028, 16778240, 16778240, 66560, 66560, 16842752, 16842752, 16778244, 65540, 16777220, 16777220, 65540, 0, 1028, 66564, 16777216, 65536, 16843780, 4, 16842752, 16843776, 16777216, 16777216, 1024, 16842756, 65536, 66560, 16777220, 1024, 4, 16778244, 66564, 16843780, 65540, 16842752, 16778244, 16777220, 1028, 66564, 16843776, 1028, 16778240, 16778240, 0, 65540, 66560, 0, 16842756),
_ = new Array(-2146402272, -2147450880, 32768, 1081376, 1048576, 32, -2146435040, -2147450848, -2147483616, -2146402272, -2146402304, -2147483648, -2147450880, 1048576, 32, -2146435040, 1081344, 1048608, -2147450848, 0, -2147483648, 32768,