Authored by yyq

change cheerio

... ... @@ -7,6 +7,7 @@
'use strict';
const _ = require('lodash');
const cheerio = require('cheerio');
const helpers = global.yoho.helpers;
... ... @@ -295,11 +296,13 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => {
}
if (result.html && !_.get(result.html, 'code', '')) {
let regContent = /<body[^>]*>([\s\S]*)<\/body>/.exec(result.html);
let $ = cheerio.load(result.html);
if (regContent && regContent.length) {
html = regContent[1] || '';
html = html.replace(/<script.*?>.*?<\/script>/ig, '');
$('script').remove();
html = $('body').html();
if (html) {
html = html.replace(/http:/ig, '');
}
}
... ...