Automatically book sold-out train tickets during Chinese New Year and other peak travel periods without manual refreshing.
Monitor 12306 ticket availability 24/7 and purchase the moment seats open up, beating other buyers.
Queue for pre-sale tickets before official release and receive instant notifications when booking succeeds.
Requires 12306 account credentials, CAPTCHA model training/weights, Docker setup, and handling China-specific network/auth constraints.
This repository is a Python-based automated ticket-buying assistant for China's national railway booking system, 12306.cn. It is designed to help users snag high-demand train tickets, particularly during peak travel periods like Chinese New Year, when tickets sell out in seconds, by automating the entire process of logging in, monitoring ticket availability, solving CAPTCHA challenges, and submitting an order the moment a seat becomes available. The problem it addresses is practical and widely felt in China: buying popular train tickets on 12306 often requires sitting in front of a browser for hours, refreshing repeatedly, and reacting faster than other users. This tool does that work automatically, running continuously in the background and acting the instant tickets appear. The way it works: you configure your travel details (dates, train numbers, passenger info, seat preferences) in a config file. The program then logs into your 12306 account automatically, polls for ticket availability on a schedule, uses a machine learning model (based on TensorFlow) to solve the image-based CAPTCHA that 12306 uses, and submits the order when a matching ticket is found. It supports pre-sale monitoring (queuing before tickets are officially released), waitlist queue mode, and sends notifications via email or the Server Chan (a push notification service for WeChat) when a ticket is successfully booked or when it needs your attention. You would use this if you are in China and need to book train tickets for a route that sells out extremely fast, and you are comfortable running a Python script on your own computer or a server. The tech stack is Python 3.6, 3.7, TensorFlow for local CAPTCHA recognition, and optionally Docker for simplified deployment. It works best on a personal home network rather than a cloud server, as 12306 actively blocks cloud IP addresses.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.