π Bangladesh Railway Ticket Auto-Booking Bot
β‘ Lightning-Fast | π§ Smart Captcha | π― Seat-Precise | π Secure OTP
An extraordinary high-performance automation engine that books
Bangladesh Railway (eticket.railway.gov.bd / Shohoz) train tickets the
instant they go on sale β faster than any human can blink.
π‘ "Stop fighting the clock. Stop refreshing pages at 8 AM. Let
the bot win the seat war for you."
β¨ Why This Bot Is Different
Most ticket bots break the moment Cloudflare Turnstile expires their token, or they crash when the server rate-limits them. This one doesn't.
π₯ Built for the real world β every error message, every Cloudflare challenge, every "ticket not available" race condition has been hunted down and fixed.
| π― Feature | π What It Means For You |
|---|---|
| Multi-threaded Turnstile Pool | 3 background solvers keep 6 fresh tokens ready 24/7 β never wait, never expire |
| Per-Seat Fresh Tokens | Every reservation request gets its own unexpired token β zero
Invalid action token errors |
| Smart Seat Preference Engine | Prioritize your favorite seat numbers, then fall back to any available seat |
| Parallel Seat Reservation | Reserves multiple seats in parallel using a thread pool β wins races against human clickers |
| Scheduled Run Time | Set it once, walk away β the bot wakes up at the exact second tickets open |
| Auto OTP Resend | If you miss the SMS, the bot re-requests OTP up to 3 times automatically |
| Auto PDF Ticket Download | After payment, your ticket PDF is downloaded and saved with a smart filename |
| Rate-Limit Auto-Recovery | Detects "wait X minutes Y seconds" responses and politely waits β no IP bans |
| bKash / Card / Nagad Ready | Whatever payment method your account uses, the bot opens the right gateway |
π¬ Live Demo β See It In Action
π Step 1 β Bot Boots & Locks Onto The Trip
The instant you launch, the bot identifies your train, route, boarding point, and counts available seats in real time.
π’ Seat class detected Β· Trip ID locked Β· Boarding point captured Β· 72
seats available
β‘ Step 2 β Parallel Seat Reservation (Faster Than Human Clicks)
The bot fires multiple reservation requests in parallel, claiming your preferred seats before anyone else can scroll.
π₯ 3 seats locked in milliseconds: KA-20,
KA-21, KA-22 β then waits for your
OTP
β Step 3 β OTP Verified β Ticket Booking Confirmed!
After OTP verification, the bot finalizes the booking and opens the bKash payment gateway instantly.
π "Ticket booking is confirmed!" β
Auto-redirects to bKash for payment
π Step 4 β PDF Ticket Auto-Downloaded
The moment payment clears, your official ticket PDF is downloaded and saved with a smart, organized filename.
π» Terminal Output Preview
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Running from folder: AC_B-D-3 β
β Captcha Balance: 12.94 | IP: 103.137.67.242 β
β Seat class: AC_B β
β Version: 0.0.4 β
β Your Bot is ready to work β
β
β Waiting... 14s remaining β
β β
β trip_id: 8566632 route: 57904643 boarding: 110759229 β
β Eligible: 23 | Preferred: 4 | Others: 19 β
β [1] seat reserved - KHA-3 β
β [2] seat reserved - KHA-7 β
β β
β Enter your OTP (press Enter to wait): 5957 β
β β
OTP received, stopping resend β
β π³ Opening bKash payment gateway... β
β π PDF downloaded: 16_Dec_2026_SUBORNO_AC_B_ticket.pdf β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π§ How It Works (The Magic Inside)
flowchart LR
A[β° Wait For Run Time] --> B[π Search Trips]
B --> C[π« Get Seat Layout]
C --> D[π§ Solve Turnstile Captcha]
D --> E[β‘ Reserve Seats In Parallel]
E --> F[π± Trigger OTP]
F --> G[β
Verify OTP]
G --> H[π³ Confirm Booking + Open Payment]
H --> I[π Auto Download Ticket PDF]
- Pre-arm phase β Bot launches early, builds a pool of fresh Cloudflare Turnstile tokens.
-
Countdown phase β Idles until your exact scheduled
run_attime. - Strike phase β The instant tickets open, it queries seat-layout, filters by your preferences, and fires parallel reservation requests with fresh tokens.
- Lock phase β Triggers passenger-details OTP, you enter the SMS code, bot verifies.
- Pay phase β Confirms booking, opens your payment gateway, polls purchase history, and downloads the PDF the moment payment completes.
3οΈβ£ Configure user_data.json
{
"token": "YOUR_RAILWAY_ACCESS_TOKEN",
"d_ID": "YOUR_DEVICE_ID",
"api_key": "YOUR_2CAPTCHA_API_KEY",
"from_city": "Dhaka",
"to_city": "Chattogram",
"date_of_journey": "20-Dec-2026",
"seat_class": "AC_B",
"trip_number": "SUBORNO EXPRESS",
"Seats_to_reserve": 2,
"set_start": 1,
"floor_name": "",
"preferred_seat_numbers": ["KHA-3", "KHA-7"],
"payment_method": 1,
"run_at": "2026-12-15 08:00:00.000000",
"info_user": [
{ "Name": "Your Name", "gender": "male", "passengerType": "Adult" }
]
}
4οΈβ£ Run It
python mian.py
The bot will sit quietly, top up its captcha pool, then strike at
run_at time.
π¨ Smart Configuration
| π Key | π Description | π Example |
|---|---|---|
from_city / to_city
|
Origin and destination stations |
"Dhaka" β "Chattogram"
|
seat_class |
Class to book |
AC_B, SNIGDHA, S_CHAIR,
SHOVAN
|
trip_number |
Train name keyword (partial match OK) | "SUBORNO" |
Seats_to_reserve |
Number of seats to lock |
1 to 4
|
preferred_seat_numbers |
Priority list β bot grabs these first | ["KHA-3", "KHA-7"] |
set_start |
Skip seat numbers below this | 1 |
floor_name |
Filter coaches by floor |
"upper" or ""
|
payment_method |
Payment gateway selector |
1 = bKash |
run_at |
Exact strike time (microsecond precision) | "2026-12-15 08:00:00.000000" |
π¦ Status Codes Decoded
| π΄ Error | π’ What The Bot Does |
|---|---|
TURNSTILE_VERIFICATION_FAILED |
Silently swaps in a fresh token and retries |
Invalid or expired action token |
Auto-rotates token from the pool |
Sorry! this ticket is not available |
Moves to the next seat instantly |
Maximum 4 seats already reserved |
Stops gracefully (server hard limit) |
Server Error 403 |
Backs off 2 seconds and retries |
Rate limited X minutes Y seconds |
Counts down precisely and resumes |
Invalid User Access Token |
Halts and asks you to refresh login |
βοΈ Architecture Highlights
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§΅ Thread 1-3: Turnstile Solver Pool (always fresh) β
β π§΅ Thread 4: OTP Auto-Resender β
β π§΅ Thread 5+: Parallel Seat Reservation Workers β
β π§΅ Main: Trip Search β Layout β Confirm β PDF β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- TTL-bounded token pool β every token is timestamped; anything older than 100s is dropped before use.
- Thread-safe shared state β all reservation lists protected by locks; no race condition can double-book.
-
Zero recursion β flat
while Trueretry loops mean unlimited resilience without stack overflow. - Boundary-only error handling β internal helpers stay clean; only network edges catch exceptions.
π Safety & Compliance
β οΈ For personal use only. This tool helps individuals reserve their own tickets faster β it does not bypass payment, security, or identity verification. You still pay through the official gateway. You still verify with your own phone's OTP. You still submit your real passenger details.
- β Uses the official Bangladesh Railway / Shohoz API β no scraping, no DOM hacks.
- β Captchas solved through legitimate 2Captcha service (you pay per solve).
- β Respects server rate limits with intelligent backoff.
- β Not affiliated with Bangladesh Railway or Shohoz.
π Roadmap
- Multi-threaded Turnstile token pool
- Per-seat fresh token rotation
- Auto OTP resend
- PDF auto-download
- Telegram bot notifications
- GUI desktop app (Electron / PyQt)
- Mobile companion app
- Multi-account orchestration
- Smart fare-class fallback
π¬ Support & Contact
π§ Need help, custom build, or premium edition?
π¬ Telegram / WhatsApp: +8801616397082
πΌ Available for freelance & paid projects β Let's
build something great together!
β Show Some Love
If this bot saved you from the 8 AM ticket war, drop a β on the repo β it really helps!
Built with β€οΈ for Bangladeshi train travelers who refuse to lose
the seat war.
Made in Bangladesh π§π©
project :https://github.com/Mahdi-hasan-shuvo/bangladesh-railway-ticket-booking-bot



Top comments (0)