mirror of https://github.com/testerSunshine/12306
增加cdn
parent
95931339db
commit
7c9ad86b6c
|
@ -147,9 +147,9 @@ PASSENGER_TICKER_STR = {
|
|||
|
||||
# 保护12306官网请求频率,设置随机请求时间,原则为5分钟不大于80次
|
||||
# 最大间隔请求时间
|
||||
MAX_TIME = 5
|
||||
MAX_TIME = 3
|
||||
# 最小间隔请求时间
|
||||
MIN_TIME = 3
|
||||
MIN_TIME = 1
|
||||
|
||||
# 软件版本
|
||||
RE_VERSION = "1.2.002"
|
||||
|
|
|
@ -27,7 +27,7 @@ class CDNProxy(threading.Thread):
|
|||
http._cdn = cdn.replace("\n", "")
|
||||
start_time = datetime.datetime.now()
|
||||
rep = http.send(url)
|
||||
if rep and "message" not in rep and (datetime.datetime.now() - start_time).microseconds / 1000 < 1000:
|
||||
if rep and "message" not in rep and (datetime.datetime.now() - start_time).microseconds / 1000 < 3000:
|
||||
if cdn.replace("\n", "") not in cdn_list: # 如果有重复的cdn,则放弃加入
|
||||
print(f"加入cdn: {cdn}")
|
||||
cdn_list.append(cdn.replace("\n", ""))
|
||||
|
|
|
@ -214,7 +214,7 @@ class select:
|
|||
else:
|
||||
random_time = round(random.uniform(sleep_time_s, sleep_time_t), 2)
|
||||
nateMsg = ' 无候补机会' if TickerConfig.ORDER_TYPE == 2 else ""
|
||||
print(f"正在第{num}次查询 随机停留时长:{random_time} 乘车日期: {','.join(TickerConfig.STATION_DATES)} 车次:{','.join(TickerConfig.STATION_TRAINS) or '所有车次'} 下单无票{nateMsg} 耗时:{(datetime.datetime.now() - now).microseconds / 1000}ms")
|
||||
print(f"正在第{num}次查询 停留时间:{random_time} 乘车日期: {','.join(TickerConfig.STATION_DATES)} 车次:{','.join(TickerConfig.STATION_TRAINS) or '所有车次'} 下单无票{nateMsg} 耗时:{(datetime.datetime.now() - now).microseconds / 1000} {queryResult.get('cdn')}")
|
||||
time.sleep(random_time)
|
||||
except PassengerUserException as e:
|
||||
print(e)
|
||||
|
|
Loading…
Reference in New Issue