复制Query.sign = function() {
function t(t) {
var e, i, s, a, r = -1;
for (e = 0,
s = t.length; s > e; e += 1) {
for (a = 255 & (r ^ t[e]),
i = 0; 8 > i; i += 1)
1 == (1 & a) ? a = a >>> 1 ^ o : a >>>= 1;
r = r >>> 8 ^ a
}
return -1 ^ r
}
function e(t, i) {
var s, o, r;
if ("undefined" != typeof e._x1l0o && i && t || (e._x1l0o = -1,
t)) {
for (s = e._x1l0o,
o = 0,
r = t.length; r > o; o += 1)
s = s >>> 8 ^ a[255 & (s ^ t[o])];
return e._x1l0o = s,
-1 ^ s
}
}
function i(t) {
var e, i, s, a, o, r = typeof t, n = 16, l = 0;
if ("string" !== r && "number" !== r)
return NaN;
if (!(e = (t = (t + "").replace(/\s/g, "").split(".")[0]).length))
return NaN;
if (n || (n = 10),
"number" != typeof n || 2 > n || n > 36)
return NaN;
for (i = t.split("").reverse(),
s = 0; e > s; s++)
(o = (a = i[s]).charCodeAt(0)) >= 97 && (a = o - 87),
l += Math.floor(a) * Math.pow(n, s);
return l
}
var s, a = [], o = i("edb" + i(15900));
return function() {
var t, e, i;
for (e = 0; 256 > e; e += 1) {
for (t = e,
i = 0; 8 > i; i += 1)
1 & t ? t = o ^ t >>> 1 : t >>>= 1;
a[e] = t >>> 0
}
}(),
(s = function(i, s) {
i = "string" == typeof i ? function(t) {
return Array.prototype.map.call(t, (function(t) {
return t.charCodeAt(0)
}
))
}(i + document.URL) : i;
return ((s ? t(i) : e(i)) >>> 0).toString(16)
}
).direct = t,
s.table = e,
s
}(),
复制
'''
爱查快递 查询 顺丰单号 物流信息
快递100
'''
import requests, time, random, json
import hashlib
import js2py
cx = '''
function t(t) {
var e, i, s, a, r = -1;
for (e = 0,
s = t.length; s > e; e += 1) {
for (a = 255 & (r ^ t[e]),
i = 0; 8 > i; i += 1)
1 == (1 & a) ? a = a >>> 1 ^ o : a >>>= 1;
r = r >>> 8 ^ a
}
return -1 ^ r
}
function e(t, i) {
var s, o, r;
if ("undefined" != typeof e._x1l0o && i && t || (e._x1l0o = -1,
t)) {
for (s = e._x1l0o,
o = 0,
r = t.length; r > o; o += 1)
s = s >>> 8 ^ a[255 & (s ^ t[o])];
return e._x1l0o = s,
-1 ^ s
}
}
function i(t) {
var e, i, s, a, o, r = typeof t, n = 16, l = 0;
if ("string" !== r && "number" !== r)
return NaN;
if (!(e = (t = (t + "").replace(/\s/g, "").split(".")[0]).length))
return NaN;
if (n || (n = 10),
"number" != typeof n || 2 > n || n > 36)
return NaN;
for (i = t.split("").reverse(),
s = 0; e > s; s++)
(o = (a = i[s]).charCodeAt(0)) >= 97 && (a = o - 87),
l += Math.floor(a) * Math.pow(n, s);
return l
}
var s, a = [], o = i("edb" + i(15900));
// return function() {
// var t, e, i;
// for (e = 0; 256 > e; e += 1) {
// for (t = e,
// i = 0; 8 > i; i += 1)
// 1 & t ? t = o ^ t >>> 1 : t >>>= 1;
// a[e] = t >>> 0
// }
// }(),
function sign(i, s) {
// var t = "SF1017195166769:15391588061440585https://www.ickd.cn/shunfeng.html",
i = "string" == typeof i ? function(t) {
return Array.prototype.map.call(t, (function(t) {
return t.charCodeAt(0)
}
))
}(i + 'https://www.ickd.cn/shunfeng.html') : i;
return ((s ? t(i) : e(i)) >>> 0).toString(16) // a5faf921
};
// var dstr = 'SF1017195166769:1539';
// var timestr = '1588061440585';
// var astr = dstr + timestr;
// var result = sign(astr, timestr);
// console.log(result);
'''
def random_pc_ua():
ua_list = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7 ",
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3 ",
]
return random.choice(ua_list)
def ai_cha(waybill, phone):
'''
爱查快递
:return:
'''
timestr = str(int(float('%.3f' % time.time()) * 1000))
astr = waybill + ':' + phone + timestr
print('astr = ', astr)
context = js2py.EvalJs()
context.execute(cx)
result_tk = context.sign(astr, timestr)
print('tk = ', result_tk)
url = f'https://biz.trace.ickd.cn/shunfeng/{waybill}:{phone}?mailNo={waybill}%3A{phone}&tk={result_tk}&tm={timestr}&callback=_jqjsp&_{timestr}='
headers = {
'user-agent': random_pc_ua(),
}
res = requests.get(url=url, headers=headers, timeout=5)
data_json = json.loads(res.text.replace('_jqjsp(', '').replace('});', '}') )
if 'update' in data_json.keys() and 'cache' in data_json.keys():
for d in data_json['data']:
print(d)
else:
ai_cha(waybill, phone)
def kuai_di_100(waybill, phone):
tempstr = round(random.uniform(0, 1), 19)
print('tempstr = ', tempstr, len(str(tempstr)))
url = f'https://www.kuaidi100.com/query?type=shunfeng&postid={waybill}&id=1&valicode=&temp={tempstr}&phone={phone}'
headers = {
'user-agent': random_pc_ua(),
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"Connection": "keep-alive",
"Host": "www.kuaidi100.com",
"Referer": "https://www.kuaidi100.com/all/sf.shtml",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
}
res = requests.get(url=url, headers=headers, timeout=5)
print('-->', res.status_code)
data_json = json.loads(res.text.replace('_jqjsp(', '').replace('});', '}') )
for d in data_json['data']:
print(d)
if __name__ == '__main__':
waybill = 'SF1017195166769'
phone = '1539'
kuai_di_100(waybill, phone)
如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?