← all repositories
yinaoxiong/12306_code_server

A captcha solver for China's most hated railway

Self-host a TensorFlow Lite model that decodes 12306's image-selection CAPTCHAs so your ticket-bot can keep running.

12306_code_server
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does Wraps a pre-trained model from the easy12306 project into a lightweight HTTP API. You POST a base64-encoded CAPTCHA image; it returns the numbers of the correct tiles to click. Designed to slot directly into the popular 12306 ticket-assistant bot, replacing its cloud-based CAPTCHA service.

The interesting bit The author runs a public instance on a Tencent Cloud student-tier VM (1 core, 1 GB RAM) and openly admits he “doesn’t guarantee availability.” That’s either refreshing honesty or a subtle nudge to self-host. The move from full TensorFlow to TensorFlow Lite in v1.1 also unlocked ARM builds, so you can now run this on a Raspberry Pi if you’re serious about your train tickets.

Key highlights

  • Single POST endpoint: /verify/base64/ returns JSON with answer tile indices
  • Docker images for amd64, arm64v8, and arm32v7; compose file included
  • Python 3.5–3.7 support (the checklist suggests nothing newer tested)
  • Public demo at 12306.yinaoxiong.cn with UptimeRobot monitoring
  • Model files hosted on author’s own CDN as a GitHub download fallback

Caveats

  • Python version ceiling at 3.7; unclear if newer versions work
  • Public instance explicitly disclaimed for reliability
  • ARM source deployment labeled “not recommended” due to dependency pain

Verdict Useful if you’re already running the 12306 ticket bot and want to stop relying on third-party CAPTCHA services. Skip it if you don’t buy Chinese railway tickets — the model is domain-specific and the API does exactly one thing.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.