|
@@ -25,7 +25,7 @@
|
|
<img src="../assets/image/m-alibaba.png" class="m-image"/><span slot="title">阿里巴巴</span>
|
|
<img src="../assets/image/m-alibaba.png" class="m-image"/><span slot="title">阿里巴巴</span>
|
|
</el-menu-item>
|
|
</el-menu-item>
|
|
<el-menu-item index="10">
|
|
<el-menu-item index="10">
|
|
- <img src="../assets/image/m-chrome.png" class="m-image"/><span slot="title">其他网址</span>
|
|
|
|
|
|
+ <img src="../assets/image/m-chrome.png" class="m-image"/><span slot="title">其他网址(Beta)</span>
|
|
</el-menu-item>
|
|
</el-menu-item>
|
|
</el-submenu>
|
|
</el-submenu>
|
|
|
|
|
|
@@ -100,6 +100,10 @@
|
|
<el-link v-if="menuIndex == '2'" :underline="false" type="danger" style="text-align: center; font-size: 12px;">
|
|
<el-link v-if="menuIndex == '2'" :underline="false" type="danger" style="text-align: center; font-size: 12px;">
|
|
(需登录京东账号后才能下载)
|
|
(需登录京东账号后才能下载)
|
|
</el-link>
|
|
</el-link>
|
|
|
|
+ <el-link v-if="menuIndex == '10'" :underline="false" type="info" style="text-align: center; font-size: 12px;">
|
|
|
|
+ (非会员功能,仅提供试用)
|
|
|
|
+ </el-link>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
<el-link v-if="((menuIndex == '3' || menuIndex == '4') && tbStatus == 3) || (menuIndex == '2' && jdStatus == 3)" :underline="false" type="danger" style="text-align: center; font-size: 12px;">登录完成后请关闭浏览器</el-link>
|
|
<el-link v-if="((menuIndex == '3' || menuIndex == '4') && tbStatus == 3) || (menuIndex == '2' && jdStatus == 3)" :underline="false" type="danger" style="text-align: center; font-size: 12px;">登录完成后请关闭浏览器</el-link>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -360,8 +364,8 @@
|
|
|
|
|
|
let path = os.tmpdir() + separator + 'chrome-data-capture';
|
|
let path = os.tmpdir() + separator + 'chrome-data-capture';
|
|
let path2 = os.tmpdir() + separator + 'chrome-data-capture-jd';
|
|
let path2 = os.tmpdir() + separator + 'chrome-data-capture-jd';
|
|
- this.deleteAll(path, false);
|
|
|
|
- this.deleteAll(path2, false);
|
|
|
|
|
|
+ //this.deleteAll(path, false);
|
|
|
|
+ //this.deleteAll(path2, false);
|
|
|
|
|
|
// 打开浏览器
|
|
// 打开浏览器
|
|
const {
|
|
const {
|
|
@@ -941,17 +945,20 @@
|
|
|
|
|
|
let num = Math.ceil(scrollHeight / cHeight);
|
|
let num = Math.ceil(scrollHeight / cHeight);
|
|
let start = -1;
|
|
let start = -1;
|
|
- urlInfo.status = '3';
|
|
|
|
let scrollInt = setInterval(async() => {
|
|
let scrollInt = setInterval(async() => {
|
|
start ++;
|
|
start ++;
|
|
- await page.evaluate((start) => {
|
|
|
|
|
|
+ num = await page.evaluate((start) => {
|
|
|
|
+ let scrollHeight = document.body.scrollHeight;
|
|
let cHeight = document.documentElement.clientHeight;
|
|
let cHeight = document.documentElement.clientHeight;
|
|
|
|
+ let num = Math.ceil(scrollHeight / cHeight);
|
|
window.scrollTo({
|
|
window.scrollTo({
|
|
top: cHeight * start,
|
|
top: cHeight * start,
|
|
behavior: "smooth"
|
|
behavior: "smooth"
|
|
});
|
|
});
|
|
|
|
+ return num;
|
|
}, start);
|
|
}, start);
|
|
if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
|
|
if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
|
|
|
|
+ urlInfo.status = '3';
|
|
clearInterval(scrollInt);
|
|
clearInterval(scrollInt);
|
|
await this.alibabaScanImg(browser, page, urlInfo, authority);
|
|
await this.alibabaScanImg(browser, page, urlInfo, authority);
|
|
this.loading = false;
|
|
this.loading = false;
|
|
@@ -1054,7 +1061,6 @@
|
|
let skuNum = 0, mainNum = 0, videoNum = 0;
|
|
let skuNum = 0, mainNum = 0, videoNum = 0;
|
|
|
|
|
|
page.on('response', async(response) => {
|
|
page.on('response', async(response) => {
|
|
-
|
|
|
|
if(titleFlag){ // 第一次生成页面标题
|
|
if(titleFlag){ // 第一次生成页面标题
|
|
if(urlInfo.title){
|
|
if(urlInfo.title){
|
|
if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
|
|
if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
|
|
@@ -1108,11 +1114,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(i) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\详情图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\详情图\\详情图' + num + suffix;
|
|
if(!authority && i < this.execNum){
|
|
if(!authority && i < this.execNum){
|
|
await this.downloadImage(imgUrl, outputPath, urlInfo);
|
|
await this.downloadImage(imgUrl, outputPath, urlInfo);
|
|
}
|
|
}
|
|
@@ -1156,81 +1168,176 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('image/')) {
|
|
|
|
- let regex = /^https:\/\/img[0-9]+.360buyimg.com\/n/;
|
|
|
|
- if(regex.exec(response.url())){ // 匹配符合规则的图片路径
|
|
|
|
- let skuReg = /\/n[0-9]+\/s(60|40)x(80|40)_jfs\//;
|
|
|
|
- if(response.url().match(skuReg) && this.settingData.skuImg){ // sku图片
|
|
|
|
- let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
- if(response.url().match(/\/n[0-9]+\/s60x80_jfs\//)){
|
|
|
|
- replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
- }
|
|
|
|
- let skuImgUrl = response.url().replace(skuReg, replaceStr).replace('.avif', '');
|
|
|
|
- if(response.url().match(skuReg))
|
|
|
|
- jdImgInfo.skuImg.push(skuImgUrl);
|
|
|
|
|
|
+ // if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('image/')) {
|
|
|
|
+ // let regex = /^https:\/\/img[0-9]+.360buyimg.com\/n/;
|
|
|
|
+ // if(regex.exec(response.url())){ // 匹配符合规则的图片路径
|
|
|
|
+ // let skuReg = /\/n[0-9]+\/s(60|40)x(80|40)_jfs\//;
|
|
|
|
+ // if(response.url().match(skuReg) && this.settingData.skuImg){ // sku图片
|
|
|
|
+ // let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
+ // if(response.url().match(/\/n[0-9]+\/s60x80_jfs\//)){
|
|
|
|
+ // replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
+ // }
|
|
|
|
+ // let skuImgUrl = response.url().replace(skuReg, replaceStr).replace('.avif', '');
|
|
|
|
+ // if(response.url().match(skuReg))
|
|
|
|
+ // jdImgInfo.skuImg.push(skuImgUrl);
|
|
|
|
|
|
- let fileName = skuImgUrl.split('/').pop();
|
|
|
|
- if(fileName){
|
|
|
|
- let queryIndex = fileName.indexOf('?');
|
|
|
|
- if (queryIndex !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex);
|
|
|
|
- }
|
|
|
|
- if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
|
|
- fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
|
|
- }
|
|
|
|
- let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
|
|
- skuNum ++;
|
|
|
|
- if(!authority && skuNum <= this.execNum){
|
|
|
|
- await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
- }
|
|
|
|
- if(authority){
|
|
|
|
- await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // let fileName = skuImgUrl.split('/').pop();
|
|
|
|
+ // if(fileName){
|
|
|
|
+ // let queryIndex = fileName.indexOf('?');
|
|
|
|
+ // if (queryIndex !== -1) {
|
|
|
|
+ // fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ // }
|
|
|
|
+ // if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
|
|
+ // fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
|
|
+ // }
|
|
|
|
+ // let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
|
|
+ // skuNum ++;
|
|
|
|
+ // if(!authority && skuNum <= this.execNum){
|
|
|
|
+ // await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
+ // }
|
|
|
|
+ // if(authority){
|
|
|
|
+ // await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
- let reg = /\/n[0-9]+\/jfs\//;
|
|
|
|
- let reg2 = /\/n[0-9]+\/s(54|50)x(54|66)_jfs\//;
|
|
|
|
- if(response.url().match(reg) || response.url().match(reg2)){ // 主图
|
|
|
|
- let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
- if(response.url().match(/\/n[0-9]+\/s50x66_jfs\//)){
|
|
|
|
- replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
- }
|
|
|
|
- let mainImgUrl = response.url().replace(reg, replaceStr).replace(reg2, replaceStr).replace('.avif', '');
|
|
|
|
- jdImgInfo.mainImg.push(mainImgUrl);
|
|
|
|
|
|
+ // let reg = /\/n[0-9]+\/jfs\//;
|
|
|
|
+ // let reg2 = /\/n[0-9]+\/s(54|50)x(54|66)_jfs\//;
|
|
|
|
+ // if(response.url().match(reg) || response.url().match(reg2)){ // 主图
|
|
|
|
+ // let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
+ // if(response.url().match(/\/n[0-9]+\/s50x66_jfs\//)){
|
|
|
|
+ // replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
+ // }
|
|
|
|
+ // let mainImgUrl = response.url().replace(reg, replaceStr).replace(reg2, replaceStr).replace('.avif', '');
|
|
|
|
+ // jdImgInfo.mainImg.push(mainImgUrl);
|
|
|
|
|
|
- let fileName = mainImgUrl.split('/').pop();
|
|
|
|
- if(fileName){
|
|
|
|
- let queryIndex = fileName.indexOf('?');
|
|
|
|
- let queryIndex2 = fileName.indexOf('!');
|
|
|
|
- if (queryIndex !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex);
|
|
|
|
- }
|
|
|
|
- if (queryIndex2 !== -1) {
|
|
|
|
- fileName = fileName.substr(0, queryIndex2);
|
|
|
|
- }
|
|
|
|
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
- fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
- }
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
|
|
- mainNum ++;
|
|
|
|
- if(!authority && mainNum <= this.execNum){
|
|
|
|
- await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
- }
|
|
|
|
- if(authority){
|
|
|
|
- await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
- }
|
|
|
|
|
|
+ // let fileName = mainImgUrl.split('/').pop();
|
|
|
|
+ // if(fileName){
|
|
|
|
+ // let queryIndex = fileName.indexOf('?');
|
|
|
|
+ // let queryIndex2 = fileName.indexOf('!');
|
|
|
|
+ // if (queryIndex !== -1) {
|
|
|
|
+ // fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ // }
|
|
|
|
+ // if (queryIndex2 !== -1) {
|
|
|
|
+ // fileName = fileName.substr(0, queryIndex2);
|
|
|
|
+ // }
|
|
|
|
+ // if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
+ // fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
+ // }
|
|
|
|
+ // let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
|
|
+ // mainNum ++;
|
|
|
|
+ // if(!authority && mainNum <= this.execNum){
|
|
|
|
+ // await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
+ // }
|
|
|
|
+ // if(authority){
|
|
|
|
+ // await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ });
|
|
|
|
+ await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
|
|
|
|
+
|
|
|
|
+ /**new**/
|
|
|
|
+ //detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
|
|
|
|
+ const imgInfo = await page.evaluate((authority, execNum) => {
|
|
|
|
+ let outObj = {
|
|
|
|
+ mainImg: [],
|
|
|
|
+ skuImg: [],
|
|
|
|
+ };
|
|
|
|
+ //主图
|
|
|
|
+ let arr1 = document.querySelectorAll('#spec-list img');
|
|
|
|
+ for(let i=0; i< arr1.length; i++){
|
|
|
|
+ let mainImgUrl = arr1[i].src;
|
|
|
|
+ let reg = /\/n[0-9]+\/jfs\//;
|
|
|
|
+ let reg2 = /\/n[0-9]+\/s(54|50)x(54|66)_jfs\//;
|
|
|
|
+ let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
+ if(mainImgUrl.match(/\/n[0-9]+\/s50x66_jfs\//)){
|
|
|
|
+ replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
+ }
|
|
|
|
+ mainImgUrl = mainImgUrl.replace(reg, replaceStr).replace(reg2, replaceStr).replace('.avif', '');
|
|
|
|
+
|
|
|
|
+ if(!authority && i < execNum){
|
|
|
|
+ outObj.mainImg.push(mainImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.mainImg.push(mainImgUrl);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //sku图片
|
|
|
|
+ let arr2 = document.querySelectorAll('#choose-attr-1 img');
|
|
|
|
+ for(let i=0; i< arr2.length; i++){
|
|
|
|
+ let skuImgUrl = arr2[i].src;
|
|
|
|
+ let skuReg = /\/n[0-9]+\/s(60|40)x(80|40)_jfs\//;
|
|
|
|
+ let replaceStr = '/n1/s800x800_jfs/';
|
|
|
|
+ if(skuImgUrl.match(/\/n[0-9]+\/s60x80_jfs\//)){
|
|
|
|
+ replaceStr = '/n1/s750x1000_jfs/';
|
|
|
|
+ }
|
|
|
|
+ skuImgUrl = skuImgUrl.replace(skuReg, replaceStr).replace('.avif', '');
|
|
|
|
+ if(!authority && i < execNum){
|
|
|
|
+ outObj.skuImg.push(skuImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.skuImg.push(skuImgUrl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
|
|
|
|
|
|
+ return outObj;
|
|
|
|
+ }, authority, this.execNum);
|
|
|
|
+ // 主图下载
|
|
|
|
+ for(let j = 0; j < imgInfo.mainImg.length; j++){
|
|
|
|
+ let fileName = imgInfo.mainImg[j].split('/').pop();
|
|
|
|
+ if(fileName){
|
|
|
|
+ let queryIndex = fileName.indexOf('?');
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
+ fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
|
|
+ fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
|
|
+ await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // sku图片下载
|
|
|
|
+ if(this.settingData.skuImg){
|
|
|
|
+ for(let j = 0; j < imgInfo.skuImg.length; j++){
|
|
|
|
+ let fileName = imgInfo.skuImg[j].split('/').pop();
|
|
|
|
+ if(fileName){
|
|
|
|
+ let queryIndex = fileName.indexOf('?');
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
+ fileName = fileName.substr(0, queryIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
|
|
+ fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
|
|
|
|
+ await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /**end**/
|
|
await jdBrowser.close();
|
|
await jdBrowser.close();
|
|
urlInfo.status = '4';
|
|
urlInfo.status = '4';
|
|
resolve(true);
|
|
resolve(true);
|
|
@@ -1317,7 +1424,7 @@
|
|
|
|
|
|
let responseVideo = [];
|
|
let responseVideo = [];
|
|
page.on('response', async(response) => {
|
|
page.on('response', async(response) => {
|
|
- // 检查响应的 MIME 类型是否以 'image/' 开头
|
|
|
|
|
|
+ // 检查响应的 MIME 类型是否以 'video/' 开头
|
|
if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('video/')) {
|
|
if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('video/')) {
|
|
responseVideo.push(response.url());
|
|
responseVideo.push(response.url());
|
|
}
|
|
}
|
|
@@ -1348,12 +1455,15 @@
|
|
let start = -1;
|
|
let start = -1;
|
|
let scrollInt = setInterval(async() => {
|
|
let scrollInt = setInterval(async() => {
|
|
start ++;
|
|
start ++;
|
|
- await page.evaluate((start) => {
|
|
|
|
|
|
+ num = await page.evaluate((start) => {
|
|
|
|
+ let scrollHeight = document.body.scrollHeight;
|
|
let cHeight = document.documentElement.clientHeight;
|
|
let cHeight = document.documentElement.clientHeight;
|
|
|
|
+ let num = Math.ceil(scrollHeight / cHeight);
|
|
window.scrollTo({
|
|
window.scrollTo({
|
|
top: cHeight * start,
|
|
top: cHeight * start,
|
|
behavior: "smooth"
|
|
behavior: "smooth"
|
|
});
|
|
});
|
|
|
|
+ return num;
|
|
}, start);
|
|
}, start);
|
|
if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
|
|
if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
|
|
urlInfo.status = '3';
|
|
urlInfo.status = '3';
|
|
@@ -1473,11 +1583,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1492,11 +1608,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
|
|
await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1512,11 +1634,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\详情图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\详情图\\详情图' + num + suffix;
|
|
await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1532,11 +1660,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\评论图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\评论图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\评论图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\评论图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\评论图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\评论图\\评论图' + num + suffix;
|
|
await this.downloadImage(imgInfo.commentImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.commentImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1656,11 +1790,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
|
|
await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1675,11 +1815,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
|
|
await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1695,11 +1841,17 @@
|
|
fileName = fileName.substr(0, queryIndex);
|
|
fileName = fileName.substr(0, queryIndex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let num = Number(j) + 1;
|
|
|
|
+ let suffix = '';
|
|
|
|
+ if(fileName.lastIndexOf('.') > -1){
|
|
|
|
+ suffix = fileName.substr(fileName.lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\详情图');
|
|
}
|
|
}
|
|
|
|
|
|
- let outputPath = urlInfo.newPath + '\\详情图\\' + fileName;
|
|
|
|
|
|
+ let outputPath = urlInfo.newPath + '\\详情图\\' + '详情图' + num + suffix;
|
|
await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
|
|
await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|