Fire! Open source Python ticket grabbing artifact, come home to see this wave of New Year!

AirPython 2021-01-20 14:44:16
open source python ticket grabbing

Spring Festival is coming , It's time to rush home again !

stay Github There are also many excellent developers open source based on Python The ticket grabbing project of , For example, it's always hot 12306/py12306, At present, it has accumulated more than 40k Star!

But if you try to use , It will be found that due to 12306 Of Captcha mechanism upgrade , These two projects are The login modules are all down , It's probably not available since last October .

but Don't panic , After some exploration , I've found a ticket grabbing project that works perfectly , And contact the developers @ What about the tea in the jar , come to know Just change some interface addresses of login module , And adjust the acquisition logic of some parameters , You can revitalize Python Ticket grabbing project 12306, The address is as follows

This article will be based on the project Detailed guidance on how to use it quickly Python Grab tickets , Go home smoothly !

Before we start, we need to understand the whole The idea of grabbing tickets

Download and dependent installation

Before running this project, you need to transfer your Python Upgrade to Python3.6 Or higher , I am a Python3.8 No problem .

First use git Pull down the original project code

git clone

Or download the compressed package and unzip it

The unzipped directory should be as follows

Then start the terminal / Command line ( Mac/Win ), and cd Enter project directory , Execute the following code to install the dependency

pip install -r requirements.txt

It should be noted that , If the download speed is too slow, you can switch the source to solve it , It's the fastest way to use alicloud image for personal testing

This article is not about installing various libraries , All in all requirements.txt in Dependency libraries must be installed correctly , If there are any installation problems , Please Baidu

Get login information

We talked about ,GitHub Number one, number two 12306 The reason why the ticket grabbing project is dead is that Login verification code cannot be processed On , But the project we are using now is not to use a user name and password to manage the account , Just when you log in Withdraw relevant information from your account cookie Field that will do , You can follow the steps below .

Start by opening 12306 Official website , Go to the login page and press F12, And select Network

Then enter the account password verification code and click login , After clicking on XHR

As indicated above , find uamauthclient The packet goes in and clicks Cookies, Then follow the instructions in the figure below to record tkRAIL_EXPIRATIONRAIL_DEVICEID Of three fields value, Copy it and save it , It will be used later

Here we get it 12306 Key information to verify our identity , Let's move on .

Configure ticket grabbing information

Now back to the project catalog , Open the To configure , There are many fields in it. You can check the description and configuration by yourself , This article only introduces some key fields

First you need to modify 53-55 The three variable values of the row , Replace it with the one we just saved tkRAIL_EXPIRATIONRAIL_DEVICEID Of three fields value, This step is very important , Because there is no need to enter the account and password to use this project , Order by these three parameters

Then modify the passengers as shown in the figure below 、 Train number 、 Travel date and other related information , Fill in this part by yourself , Not much to explain

Here we can use it directly , Of course, you can continue to follow this template file to CDN Speed up 、 agent ip、 Adjust the ticket grabbing mode and other settings , Finally, save and exit

Start project

Finally, let's start the project and grab tickets , Back to the terminal / Command line

Execute the following code to open CDN Speed up

python3 c

Then hang it backstage , Reopen a terminal / Command line and go to the project directory , Execute the following code and start to grab tickets

python3 r

As shown in the figure above , If there is no accident, it will output a lot of logs , I chose the ticket from Hangzhou to Wuhu , Because there are more tickets , So I didn't enter the ticket grabbing mode , Just order to be paid

go back to 12306, Click on my order and find a ticket lying there waiting to be paid , All functions from login to order can be used normally !

Some instructions

Because of time , I didn't test it further in ticket grabbing mode , After communicating with the project author and some of the group friends , A few more points are convenient for you to use

  • If in Windows Lower installation tensorflow Failure , Sure It's OK to reduce or increase the version appropriately (1.14.0rc\1.14.0rc\1.15.0\1.15.0rc All possible )
  • When starting the project CDN Acceleration is not necessary , You can Choose not to start I.e. direct execution python3 r
  • tk Wait for landing cookies Information may There is a certain timeliness , So you may need to check it regularly
  • If it's a standby ticket , Need to pass through Verification of witness consistency Users and activated “ The railway goes smoothly ” Members can submit alternate requests , Need to follow the operating instructions on the railway 12306 app On the completion of human verification .
  • The software is full-automatic standby plus leak detection , If the software backup succeeds, it will stop robbing tickets , Send an email notice , But it will not affect you to continue to pick up the leak , If I pick up the leak at this time , It can also be paid successfully , in other words , Leak collection + Standby mode can maximize the success rate of ticket grabbing


This article is from WeChat official account. - AirPython(AirPython)

The source and reprint of the original text are detailed in the text , If there is any infringement , Please contact the Delete .

Original publication time : 2021-01-10

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .


  1. 利用Python爬虫获取招聘网站职位信息
  2. Using Python crawler to obtain job information of recruitment website
  3. Several highly rated Python libraries arrow, jsonpath, psutil and tenacity are recommended
  4. Python装饰器
  5. Python实现LDAP认证
  6. Python decorator
  7. Implementing LDAP authentication with Python
  8. Vscode configures Python development environment!
  9. In Python, how dare you say you can't log module? ️
  10. 我收藏的有关Python的电子书和资料
  11. python 中 lambda的一些tips
  12. python中字典的一些tips
  13. python 用生成器生成斐波那契数列
  14. python脚本转pyc踩了个坑。。。
  15. My collection of e-books and materials about Python
  16. Some tips of lambda in Python
  17. Some tips of dictionary in Python
  18. Using Python generator to generate Fibonacci sequence
  19. The conversion of Python script to PyC stepped on a pit...
  20. Python游戏开发,pygame模块,Python实现扫雷小游戏
  21. Python game development, pyGame module, python implementation of minesweeping games
  22. Python实用工具,email模块,Python实现邮件远程控制自己电脑
  23. Python utility, email module, python realizes mail remote control of its own computer
  24. 毫无头绪的自学Python,你可能连门槛都摸不到!【最佳学习路线】
  25. Python读取二进制文件代码方法解析
  26. Python字典的实现原理
  27. Without a clue, you may not even touch the threshold【 Best learning route]
  28. Parsing method of Python reading binary file code
  29. Implementation principle of Python dictionary
  30. You must know the function of pandas to parse JSON data - JSON_ normalize()
  31. Python实用案例,私人定制,Python自动化生成爱豆专属2021日历
  32. Python practical case, private customization, python automatic generation of Adu exclusive 2021 calendar
  33. 《Python实例》震惊了,用Python这么简单实现了聊天系统的脏话,广告检测
  34. "Python instance" was shocked and realized the dirty words and advertisement detection of the chat system in Python
  35. Convolutional neural network processing sequence for Python deep learning
  36. Python data structure and algorithm (1) -- enum type enum
  37. 超全大厂算法岗百问百答(推荐系统/机器学习/深度学习/C++/Spark/python)
  38. 【Python进阶】你真的明白NumPy中的ndarray吗?
  39. All questions and answers for algorithm posts of super large factories (recommended system / machine learning / deep learning / C + + / spark / Python)
  40. [advanced Python] do you really understand ndarray in numpy?
  41. 【Python进阶】Python进阶专栏栏主自述:不忘初心,砥砺前行
  42. [advanced Python] Python advanced column main readme: never forget the original intention and forge ahead
  43. python垃圾回收和缓存管理
  44. java调用Python程序
  45. java调用Python程序
  46. Python常用函数有哪些?Python基础入门课程
  47. Python garbage collection and cache management
  48. Java calling Python program
  49. Java calling Python program
  50. What functions are commonly used in Python? Introduction to Python Basics
  51. Python basic knowledge
  52. Anaconda5.2 安装 Python 库(MySQLdb)的方法
  53. Python实现对脑电数据情绪分析
  54. Anaconda 5.2 method of installing Python Library (mysqldb)
  55. Python implements emotion analysis of EEG data
  56. Master some advanced usage of Python in 30 seconds, which makes others envy it
  57. python爬取百度图片并对图片做一系列处理
  58. Python crawls Baidu pictures and does a series of processing on them
  59. python链接mysql数据库
  60. Python link MySQL database