Giter VIP home page Giter VIP logo

price-monitor's Introduction

Price-Monitor:电商价格监控

Python3+requests/selenium+sqlite/mysql+免费代理池/代理接口

License Poweredby

全新Python3版本:支持协程,redis代理池,提高监控效率,持续更新中。

简介

1. 用户指定商品监控:用户自行设置商品和预期价格,低于预期价格后自动发送邮件提醒用户抢购。

2. 品类商品监控:目前数码品类开放监控,低于设定折扣(75折)的自营商品会被选出并发送邮件提醒用户抢购。

Structure

目前网站已开放:访问电商价格监控便可体验。

Pagedemo

Pagedemo2

Pagedemo3

申明:本项目仅限于爬取网上公开可见的商品信息,请勿用于任何商业用途。

最近更新

  • Selenium + Headless Chrome爬取
  • 商品副标题/商品历史价格抓取
  • 增加对Mysql数据库支持

TODO List

持续更新中

  • 代理池重构,单独检验代理对电商网站可达性
  • 爬虫采用协程库,提高采集效率
  • 支持更多的代理接口:免费代理,付费代理,vps拨号代理
  • 使用Django代替Flask作为网站后台
  • 商品副标题抓取,PLUS会员价格
  • 商品历史价格
  • Selenium + PhantomJS/Headless Chrome 爬取
  • 更方便的添加监控商品
  • Docker一键部署(即将更新)
  • 支持亚马逊**,天猫,淘宝等商城
  • 代码覆盖率测试
  • 继续重构

其他功能(欢迎Issue提供意见)

项目依赖

python3.5+

主要包含以下库:

  • requests
  • gevent
  • lxml
  • selenium(可选)

可以使用项目自带的requirements.txt安装环境

pip install -r requirements.txt

使用步骤

0. 运行脚本,新建Sqlite数据库

    python PriceMonitor/create_db.py

可以使用 sqlitedatabasebrowser查看数据库,添加用户和商品。

也可以通过conn_sql.py里运行现成代码添加用户和商品:

    add user named 'test'
    sql.write_user('test', '[email protected]')

    add test item
    sql.write_item(2777811, '10', 1)

Sqlitedemo

1. 设置邮件提醒的发件邮箱

简易教程请查看:设置发件邮箱

2. 你可以选择开启代理池抓取(2.1)或者直接使用本地抓取(2.2)

2.1 开启代理池,采用proxy_factory基于redis的简单代理工厂,感谢作者ShichaoMa。

启动redis代理池后,修改CONFIG.py的设置:

    PROXY_CRAWL = 1
    PROXY_POOL_IP = "127.0.0.1"  # Your redis server ip

2.2 直接采用本地IP进行监控(注意:请将抓取间隔CRAWL_TIME调大,避免IP被禁,单位:秒)

    CRAWL_TIME = 10  # Monitor sleep time, if not using proxy, CRAWL_TIME > 1800 recommended.
    PROXY_CRAWL = 0
    PROXY_POOL_IP = "127.0.0.1"  # Your redis server ip

3. 运行监控主程序

    python Pricemonitor/main.py

文件结构

  • docs:文档

  • PriceMonitor

    • CONFIG.py: 常用参数

    • create_db.py: 创建数据库

    • conn_sql.py: 数据操作库

    • logger.conf: 日志参数

    • proxy_(js).py: 代理(二选一,默认proxy.py)

    • crawler_selenium/js.py: 爬虫(二选一,默认crawler_selenium.py)

    • mailbox.txt: 邮箱参数

    • mail.py: 邮件模块

    • monitor_main_(js).py: 程序入口(二选一,默认monitor_main.py)  

  • requirements.txt: 安装依赖

老版本

Contribution

  • Issue

Introduction

  • Monitor price changes for items at JD.com, users could set price for specific item. Once the price is lower than excepted, the server will send an e-mail to user.

price-monitor's People

Contributors

qqxx6661 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.