diff --git a/TickerConfig.py b/TickerConfig.py index 0fb4238..62b7502 100644 --- a/TickerConfig.py +++ b/TickerConfig.py @@ -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" diff --git a/agency/cdn_utils.py b/agency/cdn_utils.py index c7c0ffe..76486c6 100644 --- a/agency/cdn_utils.py +++ b/agency/cdn_utils.py @@ -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", "")) diff --git a/init/select_ticket_info.py b/init/select_ticket_info.py index cbd93d6..86bd24a 100755 --- a/init/select_ticket_info.py +++ b/init/select_ticket_info.py @@ -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)