Code Monkey home page Code Monkey logo

mall-monitor's Introduction

mall-monitor

电商平台价格监控

alt text

技术

  1. 前端:Boostrap+Jquery
  2. 后端:Python+Flask
  3. 爬虫:requests+beautifulsoup4+PyExecJS
  4. 代理池:https://github.com/0xHJK/Proxies 简易实现

启动

$ python server.py
或者
$ nohup python server.py &

爬虫

  1. 爬取名字 https://item.jd.com/4311178.html
soup = BeautifulSoup(response.text, 'html.parser')
name = soup.find(class_='sku-name')
  1. 爬取价格 https://p.3.cn/prices/mgets?skuIds=4311178
[
  {
    "cbf": "0",
    "id": "J_4311178",
    "m": "800.00",
    "op": "399.00",
    "p": "219.00"
  }
]
  1. 爬取历史价格 http://tool.manmanbuy.com/history.aspx?DA=1&action=gethistory&url=http://item.jd.com/4311178.html&bjid=&spbh=&cxid=&zkid=&w=951&token=hbo5aec0bfd10dad3242ed1e5614d57c9b2f349auz8t (根据ID从MMM_GET_TOKEN.js获取token)
{
  "datePrice": "[1508774400000,629.00,\"\"],......"
  ......
}

数据库

Goods:

属性 解释 类型 备注
id 商品编号 String(20) primary_key=True
dname 自定义商品名 TEXT nullable=True
want 期望价格 FLOAT nullable=False
status 运行状态 BOOLEAN nullable=False

配置

修改config.cfg的参数,可以上网搜索怎么申请qq邮箱smtp密码~,记得开放25端口 钉钉token获取方式自行搜索

[mail]
host     = smtp.qq.com
port     = 25
user     = [email protected]
pass     = xxxxxxxxxxxxxxxx
sender   = [email protected]

[dingding]
webhook  = https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxx

[select]
# 邮件和钉钉通知二选一
option   = dingding

docker启动(推荐)

配置文件放在/data/jd-spider/config目录下,配置好后挂载到容器中

docker run --name jdspider -p 5858:5858 -v /data/jd-spider/config:/usr/src/app/web/config -d yimijianfang/jd-spider

mall-monitor's People

Contributors

zhangbincheng1997 avatar yimijianfang avatar

Stargazers

Shiryl L avatar  avatar zqj avatar  avatar yufei avatar rench avatar TTest avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.