Giter Site home page Giter Site logo

jdinventorymonitor's Introduction

JDInventoryMonitor

起因是朋友的一个需求,让我帮忙看看有没有办法监控京东某件商品有没有库存。网上也没搜到现成的代码,就自己粗略写了一个简陋版,原理很简单,如下:

  1. 先抓包分析哪个接口返回的信息是库存信息,抓到一个接口,响应形如:{"1566641027":{"freshEdi":null,"sidDely":"-1","channel":1,"rid":"0","sid":"-1","dcId":"-1","IsPurchase":false,"eb":"99","ec":"-1","StockState":34,"ab":"-1","canAddCart":"0","ac":"-1","ad":"-1","ae":"-1","skuState":1,"PopType":0,"af":"-1","ag":"-1","StockStateName":"无货","m":"0","rfg":0,"ArrivalDate":"","v":"0","rn":-1,"dc":"-1"}}
  2. 再通过前端找到data-sku对应的data-value(如:data-sku="1566641027" data-value="40张白边相纸"),进行一一对应;
  3. 不清楚这种方式获取数据的话,Cookie的有效期能撑多久;所以我把请求包当成了一个json数据放到了外部,每分钟先读取json数据,然后重放请求包,如果有库存则通过企业微信机器人告警,没库存则静默,如果Cookie失效则通过企业微信机器人告警,重新配置参数。

效果

不知道有没有其他现成的工具,或者其他办法。时间原因,我也没详细分析各个参数的用处,如果大家有更好的建议的话,请辛苦告诉我一下。

jdinventorymonitor's People

Contributors

ed1s0nz avatar

Stargazers

 avatar

Watchers

 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.