1 Star 0 Fork 0

guava/image

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
guava 提交于 2020-07-27 08:56 +08:00 . redis
import requests
from urllib.parse import quote
# 价格动态
from bs4 import BeautifulSoup
from database.RedisHelper import RedisHelper
from entity.Keys import Keys
from entity.ListPage import ListPage
from libs.SeleniumHelper import SeleniumHelper
redis_helper=RedisHelper()
cr = SeleniumHelper()
# keys =['客厅灯']
ks = Keys()
keys = ks.getKeys()
for item in keys:
key= quote(item)
url='https://search.suning.com/'+key+'/'
lp = ListPage()
text =lp.getPage(url)
lis = lp.getList(text)
for item in lis:
try:
price = cr.findPrice('https:'+item)
pre_price=redis_helper.get('cc:' + item)
# print(type(pre_price))
if pre_price != None:
if price<pre_price*0.2:
print('价格异常')
print(item)
if price == pre_price:
print('same price')
redis_helper.set('cc:'+item,price)
except Exception as e:
print(e)
# break
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guava/image.git
git@gitee.com:guava/image.git
guava
image
image
master

搜索帮助