|
|
|
@ -12,7 +12,7 @@ from loguru import logger
|
|
|
|
|
from cookie import get_cookie
|
|
|
|
|
|
|
|
|
|
# code by wlt233 | for LoveLive! Series AsiaTour 2024
|
|
|
|
|
# 2024.11.12 | v0.2
|
|
|
|
|
# 2024.11.13 | v0.3
|
|
|
|
|
# ref: https://www.ticketlink.co.kr/global/zh/product/51390
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -22,6 +22,7 @@ logger.add("./data/log/{time}.log")
|
|
|
|
|
|
|
|
|
|
# seat data
|
|
|
|
|
COOKIE, USERNAME, PASSWORD, HEADLESS, PROXY = "", "", "", "", ""
|
|
|
|
|
SEATS_IGNORE = []
|
|
|
|
|
with open("./data/able_d1.json", "r") as f:
|
|
|
|
|
able_d1 = json.load(f)
|
|
|
|
|
with open("./data/able_d2.json", "r") as f:
|
|
|
|
@ -43,6 +44,24 @@ for x, y in coordinates:
|
|
|
|
|
'virtualY': str(y),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
def get_seat(attr_or_seatid, day=None):
|
|
|
|
|
if not day or day == 1:
|
|
|
|
|
for k, l in able_d1.items():
|
|
|
|
|
for seat in l:
|
|
|
|
|
if seat["mapInfo"] == attr_or_seatid:
|
|
|
|
|
return 1, seat
|
|
|
|
|
elif str(seat["logicalSeatId"]) == attr_or_seatid:
|
|
|
|
|
return 1, seat
|
|
|
|
|
if not day or day == 2:
|
|
|
|
|
for k, l in able_d2.items():
|
|
|
|
|
for seat in l:
|
|
|
|
|
if seat["mapInfo"] == attr_or_seatid:
|
|
|
|
|
return 2, seat
|
|
|
|
|
elif str(seat["logicalSeatId"]) == attr_or_seatid:
|
|
|
|
|
return 2, seat
|
|
|
|
|
logger.error(f"没有找到座位:{attr_or_seatid}")
|
|
|
|
|
return None, None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,14 +128,20 @@ async def search_seats(seats):
|
|
|
|
|
for seat in l:
|
|
|
|
|
seat_id = str(seat["logicalSeatId"])
|
|
|
|
|
if "FLOOR" in seat['mapInfo'] and not sold_d1[seat_id]:
|
|
|
|
|
logger.success(f"发现内场票:d1 {seat['mapInfo']}")
|
|
|
|
|
if not seat_id in SEATS_IGNORE:
|
|
|
|
|
logger.success(f"发现内场票:d1 {seat['mapInfo']} {seat_id}")
|
|
|
|
|
seats[1].append(seat)
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"发现内场票:d1 {seat['mapInfo']} 在忽略列表中")
|
|
|
|
|
for k, l in able_d2.items():
|
|
|
|
|
for seat in l:
|
|
|
|
|
seat_id = str(seat["logicalSeatId"])
|
|
|
|
|
if "FLOOR" in seat['mapInfo'] and not sold_d2[seat_id]:
|
|
|
|
|
logger.success(f"发现内场票:d2 {seat['mapInfo']}")
|
|
|
|
|
if not seat_id in SEATS_IGNORE:
|
|
|
|
|
logger.success(f"发现内场票:d2 {seat['mapInfo']} {seat_id}")
|
|
|
|
|
seats[2].append(seat)
|
|
|
|
|
else:
|
|
|
|
|
logger.warning(f"发现内场票:d2 {seat['mapInfo']} 在忽略列表中")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -267,31 +292,38 @@ if __name__ == "__main__":
|
|
|
|
|
interval1 = int(config.get("conf", "interval1") or 10000)
|
|
|
|
|
interval2 = int(config.get("conf", "interval2") or 1000)
|
|
|
|
|
seats_str = config.get("seat", "seats")
|
|
|
|
|
seats_attr = seats_str.split(",") if seats_str else []
|
|
|
|
|
seats_list = seats_str.split(",") if seats_str else []
|
|
|
|
|
ignore_list = config.get("seat", "ignore").split(",")
|
|
|
|
|
logger.info(f"cookie = {COOKIE[:50]}...")
|
|
|
|
|
logger.info(f"proxy = {PROXY}")
|
|
|
|
|
logger.info(f"interval1 = {interval1} ms (search)")
|
|
|
|
|
logger.info(f"interval2 = {interval2} ms (lock)")
|
|
|
|
|
logger.info(f"seats = {seats_attr}")
|
|
|
|
|
logger.info(f"seats = {seats_list}")
|
|
|
|
|
|
|
|
|
|
seats = { 1: [], 2: [] }
|
|
|
|
|
for attr in seats_attr:
|
|
|
|
|
day, a = attr.split(maxsplit=1)
|
|
|
|
|
if "1" in day:
|
|
|
|
|
for k, l in able_d1.items():
|
|
|
|
|
for s in l:
|
|
|
|
|
if s["mapInfo"] == a:
|
|
|
|
|
seats[1].append(s)
|
|
|
|
|
logger.info(f"已找到位置 d1 {a},尝试锁票")
|
|
|
|
|
break
|
|
|
|
|
if "2" in day:
|
|
|
|
|
for k, l in able_d2.items():
|
|
|
|
|
for s in l:
|
|
|
|
|
if s["mapInfo"] == a:
|
|
|
|
|
seats[2].append(s)
|
|
|
|
|
logger.info(f"已找到位置 d2 {a},尝试锁票")
|
|
|
|
|
break
|
|
|
|
|
if not seats[1] and not seats[2]:
|
|
|
|
|
logger.error(f"没有找到配置的座位,开始自动搜索内场座位...")
|
|
|
|
|
for seat_str in seats_list:
|
|
|
|
|
if " " in seat_str:
|
|
|
|
|
daystr, attr = seat_str.split(maxsplit=1)
|
|
|
|
|
day = 1 if "1" in daystr else 2
|
|
|
|
|
day, seat = get_seat(attr, day)
|
|
|
|
|
else:
|
|
|
|
|
day, seat = get_seat(seat_str)
|
|
|
|
|
if day and seat:
|
|
|
|
|
seats[day].append(seat)
|
|
|
|
|
logger.info(f"已找到锁票位置 d{day} {seat['mapInfo']} {seat['logicalSeatId']}")
|
|
|
|
|
if not (seats[1] or seats[2]):
|
|
|
|
|
logger.error(f"没有找到配置的锁票座位,开始自动搜索内场座位...")
|
|
|
|
|
|
|
|
|
|
for seat_str in ignore_list:
|
|
|
|
|
if " " in seat_str:
|
|
|
|
|
daystr, attr = seat_str.split(maxsplit=1)
|
|
|
|
|
day = 1 if "1" in daystr else 2
|
|
|
|
|
day, seat = get_seat(attr, day)
|
|
|
|
|
else:
|
|
|
|
|
day, seat = get_seat(seat_str)
|
|
|
|
|
if day and seat:
|
|
|
|
|
SEATS_IGNORE.append(str(seat['logicalSeatId']))
|
|
|
|
|
logger.info(f"已找到忽略位置 d{day} {seat['mapInfo']} {seat['logicalSeatId']}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asyncio.run(loop(interval1, interval2, seats))
|
|
|
|
|