The annual “Double 11” festival is coming soon, and many people can’t fill their shopping carts, but they are happy to pay back the crematorium.

PS: If you need Python learning materials, please click on the link below to obtain them

Free Python learning materials and group communication solutions click to join

All kinds of social software are also suffering from this. All the time, they are just “help me build the building”, all kinds of fonts are bypassing the block, and some strange imagination comes out:

However, thanks to these e-commerce platforms, friends who have not been in touch for years, strangers who have added but have no conversation, have found a topic to break the embarrassment.

White-collar workers earning tens of thousands of yuan a month working from dawn to dusk for a 2.50 yuan coupon is also a reward for human confusion…

The question is, do you think you actually made it?

Rumors of “price drops” have long been heard: many products raise their prices well before Singles’ Day, only to be reduced to the original price after adding discounts. Let unwitting consumers feel to take advantage of the psychological.

Whether this rumor is true or not is easy to determine by regularly visiting product pages and recording prices. But most people don’t have the time to do that. So, we made a gadget in Python that can monitor products on a regular basis, so that you can monitor the products you want to watch.

Once the tool was complete, we randomly selected several products to test, and one of them fell victim… :

! [](https://p26-tt.byteimg.com/large/pgc-image/ef0b90a5feb745988cca9556738ac726)

The price of the thermal vest, which was previously priced at 39.9 yuan, was suddenly changed to 49.9 yuan after November, and marked “Double 11 Carnival price”, which is the original price…

! [](https://p1-tt-ipv6.byteimg.com/large/pgc-image/53ba157f083c42609a26a7a53c4b6de8)
! [](https://p1-tt-ipv6.byteimg.com/large/pgc-image/d4fe69b7e53449fdb78629d40a87a4f5)

Code implementation

The code of routine recognition is not complicated, and there are two main points:

1. First set the addresses of the items you want to monitor, and get that information from the Requests library.

For this point, different websites may have different situations. Some websites can directly obtain headers information, while others need to add some headers information. Some of the content is in the HTML page, some of the data is passed through the API interface; There are even websites that will give you a fake price when they find out you’re a machine asking for it… In our code, we take tmall, Suning, JINGdong and Pinduoduo as examples. You can read the codes for specific differences.

2. Being able to catch the price is the first step, we also need to be able to catch the time. On Windows, you can use the task scheduler to execute your PY script periodically; The Crontab function is used on Linux or Mac. We don’t need to go into details here, but you can search the keywords online, and we also give a reference tutorial link in the documentation.

With these two steps, you can have the effect of regular monitoring of commodity prices. For easy viewing, we can also add a step:

3. Use matplotlib or Pyecharts and other drawing libraries to draw the line chart of commodity price change over time. We chose the latter tool.

If you want to use our tool, just follow the format of the goods. CSV file in the code, add the link to the product you want to monitor, and then follow the instructions in the document to add it to the scheduled task of the corresponding system.

In addition, we also made a small page tool that allows you to search the same keyword products of the above four platforms in one page, which is really better than “three” :

This is actually very simple, is to use iframe to embed different home search page.

If you want to learn Python and get more Python learning tips, you can follow me!