Skip to content

Instantly share code, notes, and snippets.

@fffonion
Last active August 29, 2015 13:57
Show Gist options
  • Save fffonion/9722709 to your computer and use it in GitHub Desktop.
Save fffonion/9722709 to your computer and use it in GitHub Desktop.
四方转运怨念累积每日查询用脚本【摔
#coding:utf-8
from httplib2 import Http
import re
import time
today = time.strftime('%Y-%m-%d 00:00:00',time.localtime(time.time()))
ticket = "xxxxxxxxxxxxxxxxxx"
a,b = Http("Z:\TEMP").request("http://www.transrush.com/Transport/LogisticsTransferTrace.aspx?code=%s" % ticket,
headers = {"Referer":"http://tr.4px.com/Transport/TransportInfo.aspx",
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding":"gzip,deflate",
"User-Agent":"Mozilla/5.0"})
lines = re.findall('<li class=\'tracktime\'>([^<]+).*?<li class=\'trackmiddel[^>]+>([^<]+)</li>', b, re.DOTALL)#wtf is middel!
print(("【4px物流查询工具】\n运 单 号:%s\n物流轨迹:" % ticket).decode('utf-8'))
print('\n'.join(map(lambda x: ' '.join(x) + (' NEW' if x[0] > today else ''), lines)).decode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment