https://91ai.net/thread-1213553-1-1.html
给个大概的源码,可以获取 库存数量,大家可以根据这个在写个发送的提醒
[ol]# Import required modules
from lxml import html
import requests
# Request the page
page = requests.get('https://idc.ucany.net/cart?fid=5')
# Parsing the page
tree = html.fromstring(page.content)
# Get element using XPath,获取库存信息
num = tree.xpath('/html/body/div[3]/div/div[2]/div[5]/div/div/p/text()')[0].data.split(" ")[1]
# 库存不等于0,则发送提醒,反之,无操作
if int(num) != 0 :
# 此部分为发送提醒的,任意一个微信提醒或则bot提醒代码
pass
else:
# 此代码为无操作
pass[/ol]复制代码