1. The selenium library is a relatively flattering third-party library in the crawling process. It can skip interactions such as js and ajax, and it is easier to get started.
2. The basic code is based on the reference of other bloggers, but the Ctrip website is constantly changing. Except for the unchanged information such as ID, the rest has changed. Therefore, after careful comparison, the following code was improved and written, and released on October 19, 2021.
3. If an error occurs, please try to modify time.sleep()the function parameters in the following code.
4. To crawl the data you want, you only need to modify the departure and arrival places as well as the departure time. In addition, pay attention to modifying the browser driver. I use Microsoft Edge and download the driver from the corresponding website. After downloading, you need to rename the driver and modify the parameters driver_path.
4. It is only a basic version at present, and an updated version may be released in the future, such as adding personalized data crawling such as direct flights, transfers, and stops.
5. The code is only for learning and reference, please do not use it for commercial use!