互联网 · 2019 年 12 月 01 日 0

virmach自动加购物车脚本

const like = 10   //这里是要监控的价格
const new_plan =
  'https://billing.virmach.com/modules/addons/blackfriday/new_plan.json'
const add = https://virmach.com/manage/aff.php?pid=175
Notification.requestPermission()
let pre = ''
const main = async () => {
  let a = await fetch(new_plan)
  a = await a.json()
  cur = JSON.stringify(a)
  console.log(cur)
  if (pre === cur) {
    return
  }
  pre = cur
  a = parseFloat(a.price.match(/([\d\.]+)/)[1])
  if (a < like) {
    new Notification(a)
    window.open(add)
  }
}
main()
setInterval(main, 10000)