How biliticket/transition-ticket works
Project type and purpose
• This is a Python-based command-line ticket-sniping tool (“Transition Ticket”) designed to automate the process of grabbing “back-in-stock” tickets from Bilibili.
• It exposes a CLI interface (cli.py) that orchestrates a finite-state machine (FSM) workflow, handles login, task scheduling, captcha solving (Geetest), ticket querying, and user notification (audio/console).
File structure
• Top-level entrypoint:
• cli.py – the main CLI launcher and FSM driver
• cli.spec – PyInstaller packaging script
• “geetest” directory: static web assets (HTML/CSS/JS) used to render and solve Geetest captchas in a headless browser (Edge).
• interface/CLI: argument parsing and subcommands (user, setting, product).
• util/*: core business modules, each encapsulating a domain concern:
• Config – load/save user settings
• Login – Bilibili session management
• Captcha – integrate WebView + geetest assets
• Request – HTTP client wrappers
• Task – scheduling retry loops, polling
• Data, Info, Notice – data models, console output and sound alerts
• Bilibili – wrapper around Bilibili endpoints
• assets/alarm.wav: final notification audio
• Requirements and packaging: pyproject.toml, requirements.txt, flake.nix, pre-commit, CI workflows.
README for additional insights
• Describes an FSM-driven flow (assets/fsm.png) from “login → captcha → ticket query → notify.”
• Notes external dependencies: PortAudio (for playback), Edge browser (for captcha), Python 3.10–3.13.
• Packaging steps with PyInstaller reflect deployment concerns.