逆向案例二:关键字密文解密,自定义的加密解密。基于企名片科技的爬取。

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, 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

努力学习各种软件

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值