check-du-task.js 721 Bytes
const rp = require('request-promise');
const ddAlert = require('../libs/dingding-alert');
const {logger} = require('../libs/logger');
const REG_CHECK = /="(\d\.\d\.\d)"/;
const version = '3.5.0';

module.exports = async() => {
  const html = await rp('http://du.hupu.com/mdu/product/detail.html?id=1&source=boutiqueRecommend');

  const match = html.match(REG_CHECK);

  if (!match || match[1] !== version) {
    logger.info(`[check-du-task] 页面版本发生变化,应该为:${version},实际为:${match[1]}`);
    ddAlert(`【爬虫-毒页面检测】毒页面接口版本发生变化,应该为:${version},实际为:${match[1]} @18661200251`);
    return;
  }
  logger.info('[check-du-task] pass');
};