哲风壁纸续篇
CreatedUpdated
南极洲
脚本脚本哲风壁纸续篇
妃爱阿巴阿巴
昨天爬完发现下载还要滑块……今天继续

这个包返回的是滑块与滑块图,当然是加密后的,解密还是昨天的方法
还要滑快点,慢点就要超时。。。。

滑动滑块位移值也是加密的,解密方法同上

成功会返回以上值,继续解密

toke后面似乎是23位的时间戳,验证后也确实可以正常请求数据
wtld就是图片id
最终结果

不过这个网站不登陆只能下5次,更换ua应该就能解决,或者上ip池
源码
import requests import ddddocr import hashlib import base64 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import re import json import os import time
def get_data(r): j = "68zhehao20776519".encode('utf-8') q = "aa176b7519e84710".encode('utf-8') cipher = AES.new(j, AES.MODE_CBC, iv=q) padded_data = pad(r.encode('utf-8'), AES.block_size) ciphertext = cipher.encrypt(padded_data) hex_encoded = ciphertext.hex() base64_encoded = base64.b64encode(bytes.fromhex(hex_encoded)).decode('utf-8') return base64_encoded
def send(): cookies = { }
headers = { }
response = requests.get('https://haowallpaper.com/link/pc/public/slider', cookies=cookies, headers=headers).json() encoded=response['data'] print(encoded) return encoded
def y(r): if not isinstance(r, str): return r decoded_hex = base64.b64decode(r).hex() se = "68zhehao20776519".encode('utf-8') he = "aa176b7519e84710".encode('utf-8')
cipher = AES.new(se, AES.MODE_CBC, iv=he) ciphertext_bytes = bytes.fromhex(decoded_hex) decrypted_data = cipher.decrypt(ciphertext_bytes) unpadded_data = unpad(decrypted_data, AES.block_size) decrypted_string = unpadded_data.decode('utf-8').rstrip('\x00') print(type(decrypted_string)) decrypted_string=json.loads(decrypted_string) originalImage= decrypted_string['originalImage'] sliderImage=decrypted_string['sliderImage'] save_path='C:\\Users\\atri1\\vscode\\slide' save_name=f'{originalImage.split('/')[-1]}.jpg' save_file=os.path.join(save_path,save_name) originalImage = re.sub(r'data:image\/webp;base64,', '',originalImage) sliderImage=re.sub(r'data:image\/webp;base64,', '',sliderImage) image_data = base64.b64decode(originalImage) image_data1= base64.b64decode(sliderImage) det=ddddocr.DdddOcr(det=False,ocr=False)
res=det.slide_match(image_data, image_data1,simple_target=True) value=res['target'][0] print(res) return value
def get_encode_value(r): j = "68zhehao20776519".encode('utf-8') q = "aa176b7519e84710".encode('utf-8') cipher = AES.new(j, AES.MODE_CBC, iv=q) padded_data = pad(r.encode('utf-8'), AES.block_size) ciphertext = cipher.encrypt(padded_data) hex_encoded = ciphertext.hex() base64_encoded = base64.b64encode(bytes.fromhex(hex_encoded)).decode('utf-8') print(f'base64_encoded: {base64_encoded}') return base64_encoded
def send_slide(value): cookies = { }
headers = { } url=f'https://haowallpaper.com/link/pc/public/slider/validate?data={value}' response = requests.post(url, cookies=cookies, headers=headers) print(response.text) def download(): cookies = { }
headers = {
} timestamp = int(time.time() * 1_000_000_000)
timestamp_str = str(timestamp)
timestamp_str = timestamp_str.zfill(23) wtid=16202553122147712 data=f'{{"wtId":"{wtid}","token":"ack:_{str(timestamp_str)}","soType":1}}' enc_data=get_data(data) tsdata = { 'data': enc_data, } print(enc_data) response = requests.post('https://haowallpaper.com/link/common/file/getFileImg', cookies=cookies, headers=headers, data=tsdata) if response.status_code !=200: print(response.text) f=open('1.jpg','wb')
f.write(response.content)
if __name__ == '__main__': enc=send() dec = y(enc) encode_value=get_encode_value(str(dec)) print(encode_value) send_slide(encode_value) download()
|