Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use selenium Library to crawl JD.com 's python Books and store them in csv

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to use the selenium library to crawl 100 pages of JD.com 's python books into csv, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Analyze the page.

In the past, it was very troublesome to get using requests libraries and so on.

Using the selenium library can save a lot of things, we just need to get the click to the next page

Crawl the product information we need and store it in csv.

So we have to write three ways to do it.

2. Realize the get_products method of obtaining commodity information.

We need to grab, number, title, price, evaluation quantity, publishing house

Let's open the JD.com page and switch to developer mode, as shown in the figure:

All goods have a class name: gl-item

Data-sku is a number, and the following class name needs to be used.

The class of the price is J _ plus number.

The id of the evaluation number is Jacks comment _ plus number

The class of the title is p-name.

The class of the publisher is curr-shop.

So we can implement get_products to get the product information:

3. Click the next page for implementation

4. Deposit into csv

The above content is how to use the selenium library to climb 100 pages of JD.com 's python books and store them in csv. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report