1. url:http://www.300600900.cn/
2. target:
3. 简单分析
偶然发现,这个网站的加密,和landChina加密一模一样,js函数的名字都一样。。。所以,只贴出一些代码,有兴趣可以参考:
js加密(四)landChina
4. 代码:
from afterWork.config import userAgent, proxies import requests import re import execjs targetUrl = 'http://www.300600900.cn/' sess = requests.session() res = sess.get(url=targetUrl) # print(res.text) # 执行js with open('jsCode.js', 'r') as f: jsCode = f.read() ctx = execjs.compile(jsCode) result = ctx.call('YunSuoAutoJump') # print(result) secondUrl = 'http://www.300600900.cn' + result # print(secondUrl) _ = sess.get(url=secondUrl) res3 = sess.get(url=targetUrl) # print(res3.encoding) res3.encoding = 'UTF-8' # print(res3.text) regForInfo = r'<h2>(.*?)</h2>' productList = re.findall(regForInfo, res3.text) for info in productList: print(info)
结果:
学习交流,勿作他用。