Translator:Henyee TranslationsEditor:Henyee Translations
The computer room was deserted with not a single person in sight.
After all, this was during the summer vacation. The students studying for the graduate entrance exam would not normally use computers.
Lu Zhou went to adjust the air conditioner and sat down. He entered his own student ID and password and skillfully logged onto the computer.
The reason why he chose the schools computer room was mainly due to the fact that programs written in Python had to be run on a Linux computer. Thus, learning Python with a Linux operating system was necessary.
Also, Lu Zhous second-hand laptop was too crappy. It took forever just to convert a thesis into a PDF file. When he played League of Legends, everyone would be connected but he would be stuck at the fountain. Running a dual operating system or a virtual machine was impossible.
The textbook explained this clearly. I didnt expect it to be so difficult to actually do Sure enough, to write on paper and to actually code are two completely different things. I guess I would have to learn this by practice.
It was the first time that Lu Zhou had used a Linux computer. He looked at the instructions that he borrowed from the library and finally figured it out.
Speaking of which, it made sense that Windows took over such a huge OS market share. Even a noob that had never touched a computer before could use the Windows interface.
However, the Linux system was different. It was mainly based on command-line operations. Everything had to be done through the keyboard. Fortunately, the school installed a distribution with a desktop environment. Thus, Lu Zhou could still use the mouse.
Of course, there were obvious advantages of the Linux operating system. It had superior customizability and security, making it more suitable for servers. Also, once one was familiar with the command line operations, ones efficiency would be several times higher than using Windows. Therefore, many companies would ask programmers if they could use Linux OS before recruiting them.
Lu Zhou was finally familiar with Linuxs basic operations. He opened up a Python software, opened up the textbook, and sat in front of the computer.
I heard one of the best uses of Python is to write a web crawler. If I want to take my knowledge to the test, this should be a good place to start. But what kind of crawler should I code?
Lu Zhou fell into deep thought.
Crawl blogs on Weibo?
Crawl posts on Tieba?
Seems pretty boring.
The key is that the data crawled is useless and I cant even store them if it was too large.
Suddenly, his heart ached. He recalled the painful experience of buying a train ticket to go home. It was not because his computer was slow, but because the user interface of the railway website was horrible.
Use crawler technology to crawl the stations, trains, and ticket information from the website  Seems to be feasible.
Lu Zhou thought that since he was here, he did not want to waste any more time and immediately began to work.
After all, the crawler program was mentioned in the textbook as it was a typical example of the application of Python. The book even provided different calculation methods for different situations.
Of course, 12306 was not an average forum website. Targeting this website as a beginner was quite difficult.
However, for a genius like Lu Zhou, who studied the entire textbook, it was not a big problem. Technically, the crawler itself was not too difficult. The entire program was less than 30 lines. It compiled perfectly with no bugs.
It was time for grabbing.
Lu Zhou copied the URL of the website into the code and ran the script. He downloaded the data into a spreadsheet file he created.
Immediately after, the computer fan began to hum. The computer was running with the lines of code flashing in the black terminal box. The data was automatically entered into the spreadsheet.
Lu Zhou looked at the spreadsheet being filled and leaned against the chair.
Python is so convenient. No wonder so many experts recommend this language.
Lu Zhou looked at the lines of data flashing and felt like a hacker.
However, that was just an illusion. This was completely different than actual hacking. It was not illegal to crawl public information from a server. At most, the server administrator would be pissed off that he was using the servers bandwidth.
Therefore, many selfish websites had set up anti-crawling measure. One could not crawl any information from them. Even if one did, the information crawled would be garbage. Other less advanced websites could monitor the number of visits and block the IP address.
However, the 12306 website was unselfish. The giant monopoly did not even care about the user experience. Obviously, it would not care about the servers resources. As long as one did not take down their server, no one cared!
Lu Zhou looked at the lines of data piling up in the spreadsheet. He started to wonder if he should do something else?
Make a ticket-buying website? Seems kind of redundant
Suddenly, a light bulb went off in Lu Zhous head.
I make a ticket-buying app?
He thought of his idea and could not control his excitement.
Although there were many third-party ticket booking websites, there were not that many apps. If he could make an outstanding app, he could even make some money off it.
Lu Zhou thought about money and he was suddenly interested. His mind started to calculate.
Technically, it was very difficult to independently build an app, full stack. It was far more difficult than writing a simple crawler program, but it was not impossible. He could use the system to solve difficult problems. After all, spending general points to buy knowledge was a part of learning.
Once he completed the mission and unlocked the artificial intelligence technology branch, it would definitely come in handy.
It was just that the servers could be expensive. Even the electricity bills and the various maintenance costs could be pretty expensive
He had less than ten thousand yuan in his bank account and so, he could not do anything
Lu Zhou bit his teeth and decided to overcome these problems.
If I can reject a half a million yuan salary, I can do anything!
Even if he failed, he could use it as a learning lesson.
Therefore, Lu Zhou terminated the program. He did not rush to change the code. He opened up a Word document and just like a thesis, he started to write an application development outline.
I have to crawl real-time data of the train ticket. The server requirements are very high and so, the code has to be as efficient as possible!
The interface can be simple. But the information has to be accurate and comprehensive. I should look at third-party ticket booking apps as a reference, but I cant be completely similar I have to come up with an original idea
Lu Zhou wrote until this part and his finger rubbed the keyboard gently. He thought for a long time and began to tap on the keyboard again.
First of all, to automatically buy the tickets is not new. A lot of other browsers have this feature.
But to automatically buy the tickets offline I havent seen that yet.
Lu Zhou thought back to last winter vacation. He had to refresh the website in his dorm for nearly half an hour before he managed to book a couple of tickets. He felt that it was difficult for people to go home for the New Year.
To constantly refreshed the official website would give one a low probability of getting a ticket as there might be some which might be tickets that were refunded from others. Lu Zhou did not know where the tickets could come from, but the function could be considered.
For example, setting a time period and several train times. The server would automatically refresh the data and submit the request the moment the ticket appears. He had used several ticket snatching software, and so far, this feature did not seem to be available.
Furthermore, the concept did not seem that hard to implement.
Lu Zhou thought until this point before he looked at the clock.
Its three oclock in the afternoon!
Lu Zhou saved the Word document. He then pulled up his sleeves and placed his hands on the keyboard.