In this project, I am trying to retrieve all the item information on one page from 58.com. The logic is, first retrieve all the links on the page, and then depending whether it is the personal item or the commercial item, try to retrieve all the item information on that page based on the unique css selector.
In the following code, I created two main functions: "get_links(sale_category)" to retrieve all the links and "get_item_info(sale_category)" to retrieve all the detailed item information for each of those links. The "sale_category" determines whether the item belongs to the personal one (0) or commercial one (1). Inside the "get_item_info(sale_category)" function, I am using the "if-else" to separate the personal items and commercial items. The css used to retrieve the detailed item information between the personal and commercial items are also quite different, as you can see in the following code. However, fer the commercial item, I created a function called the "number of views" to get the view number since the details were embedded in the js code. This is something totally new to me, so it is worth mentioning here.