|
@@ -225,7 +225,6 @@
|
|
|
jdList: [],
|
|
jdList: [],
|
|
|
redList: [],
|
|
redList: [],
|
|
|
commonList: [],
|
|
commonList: [],
|
|
|
- alibabaShop: {},
|
|
|
|
|
|
|
|
|
|
execNum: 5, //限制
|
|
execNum: 5, //限制
|
|
|
checkLoading: false, //点击检测登录状态
|
|
checkLoading: false, //点击检测登录状态
|
|
@@ -291,15 +290,14 @@
|
|
|
if(os.release() && os.release().indexOf('.') > -1){
|
|
if(os.release() && os.release().indexOf('.') > -1){
|
|
|
let systemVersion = Number(os.release().split('.')[0]);
|
|
let systemVersion = Number(os.release().split('.')[0]);
|
|
|
if(systemVersion < 10){ // 低于win10,软件打开时候浏览器设置为兼容版
|
|
if(systemVersion < 10){ // 低于win10,软件打开时候浏览器设置为兼容版
|
|
|
- this.$utils.setStorage('versionType', 1);
|
|
|
|
|
- }else{
|
|
|
|
|
- this.$utils.setStorage('versionType', 2);
|
|
|
|
|
|
|
+ this.$notify.error({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ message: 'Win10以下系统请在软件设置中配置本地浏览器地址,否则软件将无法使用!',
|
|
|
|
|
+ duration: 0
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 初始化开发者设置
|
|
|
|
|
- this.$utils.setStorage('waitUntil', 'networkidle2');
|
|
|
|
|
-
|
|
|
|
|
document.getElementById('aaa').addEventListener('contextmenu', e => {
|
|
document.getElementById('aaa').addEventListener('contextmenu', e => {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
// 发送事件到主进程,附带元素类型信息
|
|
// 发送事件到主进程,附带元素类型信息
|
|
@@ -340,8 +338,16 @@
|
|
|
},
|
|
},
|
|
|
// 实时获取浏览器路径
|
|
// 实时获取浏览器路径
|
|
|
initPath(){
|
|
initPath(){
|
|
|
- let chromePath = this.$utils.getStorage('chromePath');
|
|
|
|
|
|
|
+ let chromeType = this.$utils.getStorage('chromeType');
|
|
|
|
|
+ let chromePath = puppeteer.executablePath().replace('win32-1', 'win64-1');
|
|
|
|
|
+ if(chromeType == 1){ // 电脑自带浏览器
|
|
|
|
|
+ chromePath = this.$utils.getStorage('chromePath');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ chromePath = puppeteer.executablePath().replace('win32-1', 'win64-1');
|
|
|
|
|
+ }
|
|
|
return chromePath;
|
|
return chromePath;
|
|
|
|
|
+ // let chromePath = this.$utils.getStorage('chromePath');
|
|
|
|
|
+ // return chromePath;
|
|
|
},
|
|
},
|
|
|
// 实时获取浏览器数据缓存
|
|
// 实时获取浏览器数据缓存
|
|
|
initDataDir(tag){
|
|
initDataDir(tag){
|
|
@@ -576,6 +582,34 @@
|
|
|
});
|
|
});
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ let urlReg = /^https?:\/\/(w\d+|[\w-]+)\.taobao\.(com|hk|[\w-]+)(\/[^\s]*)?$/; //店铺首页
|
|
|
|
|
+ switch(this.menuIndex){
|
|
|
|
|
+ case '1': //阿里巴巴
|
|
|
|
|
+ urlReg = /^https?:\/\/(w\d+|[\w-]+)\.1688\.(com|hk|[\w-]+)(\/[^\s]*)?$/;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '2': //jd
|
|
|
|
|
+ urlReg = /^https?:\/\/(w\d+|[\w-]+)\.jd\.(com|hk|[\w-]+)(\/[^\s]*)?$/;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '4': //tmall
|
|
|
|
|
+ urlReg = /^https?:\/\/(w\d+|[\w-]+)\.(taobao|tmall)\.(com|hk|[\w-]+)(\/[^\s]*)?$/;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '5': //red
|
|
|
|
|
+ urlReg = /^https?:\/\/(w\d+|[\w-]+)\.xiaohongshu\.(com|hk|[\w-]+)(\/[^\s]*)?$/;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case '10': //
|
|
|
|
|
+ urlReg = /^https?:\/\/[\w-]+\.[\w-]+\.[\w-]+(\/[^\s]*)?$/;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!urlReg.test(this.formatUrl.trim())){
|
|
|
|
|
+ this.$notify.warning({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ message: '网址链接和平台不对应,请确认后重试!'
|
|
|
|
|
+ });
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.addLoading = true;
|
|
this.addLoading = true;
|
|
|
if(this.loginBrowser){
|
|
if(this.loginBrowser){
|
|
|
await this.loginBrowser.close();
|
|
await this.loginBrowser.close();
|
|
@@ -714,9 +748,9 @@
|
|
|
waitUntil = this.initDevelop().waitUntil;
|
|
waitUntil = this.initDevelop().waitUntil;
|
|
|
|
|
|
|
|
let searchReg = /^https?:\/\/(s|search).taobao.com\/search/;
|
|
let searchReg = /^https?:\/\/(s|search).taobao.com\/search/;
|
|
|
- let tbShopReg = /^https?:\/\/(?!www|item)(shop\d+|[\w-]+)\.taobao\.com(\/[^\s]*)?$/; //店铺首页
|
|
|
|
|
- let tbShopReg2 = /^https?:\/\/(?!www|item)(shop\d+|[\w-]+)\.(taobao|tmall)\.com(\/(search|category)[^\s]*)?$/; // 店铺搜索和店铺分类
|
|
|
|
|
- let tmallShopReg = /^https?:\/\/(?!www|list|detail)([\w-]+)\.tmall\.(com|hk)(\/[^\s]*)?$/
|
|
|
|
|
|
|
+ let tbShopReg = /^https?:\/\/(?!www|item|s|search)(shop\d+|[\w-]+)\.taobao\.com(\/[^\s]*)?$/; //店铺首页
|
|
|
|
|
+ let tbShopReg2 = /^https?:\/\/(?!www|item|s|search)(shop\d+|[\w-]+)\.(taobao|tmall)\.com(\/(search|category)[^\s]*)?$/; // 店铺搜索和店铺分类
|
|
|
|
|
+ let tmallShopReg = /^https?:\/\/(?!www|list|detail|s|search)([\w-]+)\.tmall\.(com|hk)(\/[^\s]*)?$/
|
|
|
let shopGoodsCurrentPage = 1;
|
|
let shopGoodsCurrentPage = 1;
|
|
|
let shopGoodstotalPage = 1;
|
|
let shopGoodstotalPage = 1;
|
|
|
let tbShopGoods = {
|
|
let tbShopGoods = {
|
|
@@ -752,7 +786,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let listFag = false;
|
|
let listFag = false;
|
|
|
- if(typeStr == 'tbCategory'){ //搜索
|
|
|
|
|
|
|
+ if(typeStr == 'tbCategory'){ //主页搜索
|
|
|
let recommendObj = await page.$$('[class^=container-]>div[class^=title-]');
|
|
let recommendObj = await page.$$('[class^=container-]>div[class^=title-]');
|
|
|
if(recommendObj && recommendObj.length > 0){ //搜索结果数量不多,不存在分页情况
|
|
if(recommendObj && recommendObj.length > 0){ //搜索结果数量不多,不存在分页情况
|
|
|
listFag = true; //此时只获取mtop.taobao.shop.simple.fetch中的数据
|
|
listFag = true; //此时只获取mtop.taobao.shop.simple.fetch中的数据
|
|
@@ -841,11 +875,11 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for(let i = Number(currentPage); i < Number(totalPage)+1; i++){
|
|
for(let i = Number(currentPage); i < Number(totalPage)+1; i++){
|
|
|
- let pValue = i + 1;
|
|
|
|
|
- let pageHandle = await page.$$('.next-pagination-jump-input input');
|
|
|
|
|
- if(pageHandle && pageHandle.length > 0){ // 页码多,可以点击跳转制定页码
|
|
|
|
|
- await page.type('.next-pagination-jump-input input', pValue.toString());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // let pValue = i + 1;
|
|
|
|
|
+ // let pageHandle = await page.$$('.next-pagination-jump-input input');
|
|
|
|
|
+ // if(pageHandle && pageHandle.length > 0){ // 页码多,可以点击跳转制定页码
|
|
|
|
|
+ // await page.type('.next-pagination-jump-input input', pValue.toString());
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
let itemTitle = searchTitle + '-' + i;
|
|
let itemTitle = searchTitle + '-' + i;
|
|
|
const imgInfo = await page.evaluate((itemTitle) => {
|
|
const imgInfo = await page.evaluate((itemTitle) => {
|
|
@@ -907,7 +941,6 @@
|
|
|
this.tbList.push(imgInfo);
|
|
this.tbList.push(imgInfo);
|
|
|
await this.delay();
|
|
await this.delay();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
await this.tbBrowser.close();
|
|
await this.tbBrowser.close();
|
|
|
this.addLoading = false;
|
|
this.addLoading = false;
|
|
|
}
|
|
}
|
|
@@ -949,7 +982,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(this.alibabaList.length == 0){
|
|
|
|
|
|
|
+ // if(this.alibabaList.length == 0){
|
|
|
let searchTitle = await this.getTitle(page, '阿里巴巴商品链接');
|
|
let searchTitle = await this.getTitle(page, '阿里巴巴商品链接');
|
|
|
let outObj = {
|
|
let outObj = {
|
|
|
title: searchTitle + '-1',
|
|
title: searchTitle + '-1',
|
|
@@ -960,7 +993,7 @@
|
|
|
loading: false
|
|
loading: false
|
|
|
};
|
|
};
|
|
|
this.alibabaList.push(outObj);
|
|
this.alibabaList.push(outObj);
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
if(detailInfo.data && detailInfo.data.content){
|
|
if(detailInfo.data && detailInfo.data.content){
|
|
|
let offerList = detailInfo.data.content.offerList;
|
|
let offerList = detailInfo.data.content.offerList;
|
|
@@ -1378,7 +1411,6 @@
|
|
|
totalPage = pageInfo.totalPage;
|
|
totalPage = pageInfo.totalPage;
|
|
|
|
|
|
|
|
for(let i = Number(currentPage); i < Number(totalPage)+1; i++){
|
|
for(let i = Number(currentPage); i < Number(totalPage)+1; i++){
|
|
|
- let pValue = i + 1;
|
|
|
|
|
let itemTitle = searchTitle + '-' + i;
|
|
let itemTitle = searchTitle + '-' + i;
|
|
|
|
|
|
|
|
if(typeStr == 'jdShop'){
|
|
if(typeStr == 'jdShop'){
|
|
@@ -1443,113 +1475,88 @@
|
|
|
this.jdList.push(imgInfo);
|
|
this.jdList.push(imgInfo);
|
|
|
});
|
|
});
|
|
|
}else{
|
|
}else{
|
|
|
- let nextBtn = await page.$x("//button[contains(text(), '下一页 >')]");
|
|
|
|
|
- if(typeStr == 'alibaba'){ // 阿里巴巴分页
|
|
|
|
|
- let outObj = {
|
|
|
|
|
- title: searchTitle + '-' + Number(i+1),
|
|
|
|
|
- currentPage: 1,
|
|
|
|
|
- totalPage: 1,
|
|
|
|
|
- urls: [],
|
|
|
|
|
- status: '1',
|
|
|
|
|
- loading: false
|
|
|
|
|
- };
|
|
|
|
|
- if(nextBtn && nextBtn.length > 0){
|
|
|
|
|
- let nextSibling = await page.$x("//button[contains(text(), '下一页 >')]/following-sibling::*[1]");
|
|
|
|
|
- if(nextSibling && nextSibling.length > 0){
|
|
|
|
|
- let page = await nextSibling[0].evaluate(el => el.innerText.trim());
|
|
|
|
|
- if(page){
|
|
|
|
|
- outObj.currentPage = Number(page.split('/')[0])+1;
|
|
|
|
|
- outObj.totalPage = Number(page.split('/')[1]);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if(outObj.currentPage <= outObj.totalPage){
|
|
|
|
|
- this.alibabaList.push(outObj);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const imgInfo = await page.evaluate((currentPage, totalPage, itemTitle, typeStr) => {
|
|
|
|
|
- let outObj = {
|
|
|
|
|
- title: itemTitle,
|
|
|
|
|
- currentPage: currentPage,
|
|
|
|
|
- totalPage: totalPage,
|
|
|
|
|
- urls: [],
|
|
|
|
|
- status: '1',
|
|
|
|
|
- loading: false
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- let total = document.querySelector('[class^=pagination] [class=page-info]');
|
|
|
|
|
- if(total){
|
|
|
|
|
- outObj.currentPage = total.innerText.split('/')[0];
|
|
|
|
|
- outObj.totalPage = total.innerText.split('/')[1];
|
|
|
|
|
- }else{
|
|
|
|
|
- total = document.querySelector('[class^=ui-page-s-len]');
|
|
|
|
|
|
|
+ if(typeStr != 'alibaba'){
|
|
|
|
|
+ const imgInfo = await page.evaluate((currentPage, totalPage, itemTitle, typeStr) => {
|
|
|
|
|
+ let outObj = {
|
|
|
|
|
+ title: itemTitle,
|
|
|
|
|
+ currentPage: currentPage,
|
|
|
|
|
+ totalPage: totalPage,
|
|
|
|
|
+ urls: [],
|
|
|
|
|
+ status: '1',
|
|
|
|
|
+ loading: false
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ let total = document.querySelector('[class^=pagination] [class=page-info]');
|
|
|
if(total){
|
|
if(total){
|
|
|
outObj.currentPage = total.innerText.split('/')[0];
|
|
outObj.currentPage = total.innerText.split('/')[0];
|
|
|
outObj.totalPage = total.innerText.split('/')[1];
|
|
outObj.totalPage = total.innerText.split('/')[1];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ total = document.querySelector('[class^=ui-page-s-len]');
|
|
|
|
|
+ if(total){
|
|
|
|
|
+ outObj.currentPage = total.innerText.split('/')[0];
|
|
|
|
|
+ outObj.totalPage = total.innerText.split('/')[1];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //主图
|
|
|
|
|
- let arr1 = document.querySelectorAll('#J_ShopSearchResult dl[class^=item]');
|
|
|
|
|
- if(arr1 && arr1.length == 0){
|
|
|
|
|
- arr1 = document.querySelectorAll('dl[class^=item]');
|
|
|
|
|
- }
|
|
|
|
|
- let comboDom = document.querySelector('.comboHd');
|
|
|
|
|
- let comboLen = 0;
|
|
|
|
|
- if(comboDom){ // 店铺推荐商品过滤掉
|
|
|
|
|
- let len1 = 0, len2 = 0, len3 = 0;
|
|
|
|
|
- if(comboDom.nextElementSibling){
|
|
|
|
|
- len1 = comboDom.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
- }
|
|
|
|
|
- if(comboDom.nextElementSibling.nextElementSibling){
|
|
|
|
|
- len2 = comboDom.nextElementSibling.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let arr1 = document.querySelectorAll('#J_ShopSearchResult dl[class^=item]');
|
|
|
|
|
+ if(arr1 && arr1.length == 0){
|
|
|
|
|
+ arr1 = document.querySelectorAll('dl[class^=item]');
|
|
|
}
|
|
}
|
|
|
- if(comboDom.nextElementSibling.nextElementSibling.nextElementSibling){
|
|
|
|
|
- len3 = comboDom.nextElementSibling.nextElementSibling.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
|
|
+ let comboDom = document.querySelector('.comboHd');
|
|
|
|
|
+ let comboLen = 0;
|
|
|
|
|
+ if(comboDom){ // 店铺推荐商品过滤掉
|
|
|
|
|
+ let len1 = 0, len2 = 0, len3 = 0;
|
|
|
|
|
+ if(comboDom.nextElementSibling){
|
|
|
|
|
+ len1 = comboDom.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(comboDom.nextElementSibling.nextElementSibling){
|
|
|
|
|
+ len2 = comboDom.nextElementSibling.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(comboDom.nextElementSibling.nextElementSibling.nextElementSibling){
|
|
|
|
|
+ len3 = comboDom.nextElementSibling.nextElementSibling.nextElementSibling.querySelectorAll('dl').length;
|
|
|
|
|
+ }
|
|
|
|
|
+ comboLen = len1 + len2 + len3;
|
|
|
}
|
|
}
|
|
|
- comboLen = len1 + len2 + len3;
|
|
|
|
|
- }
|
|
|
|
|
- let length = arr1.length-comboLen;
|
|
|
|
|
- for(let i=0; i<length; i++){
|
|
|
|
|
- let href = arr1[i].querySelector('[class^=photo] a').href;
|
|
|
|
|
- let id = arr1[i].dataset.id;
|
|
|
|
|
- let title = arr1[i].querySelector('[class^=item-name]') ? arr1[i].querySelector('[class^=item-name]').innerText : '淘宝商品'+new Date().getTime();
|
|
|
|
|
- let priceInt = arr1[i].querySelector('[class^=c-price]') ? arr1[i].querySelector('[class^=c-price]').innerText : 0;
|
|
|
|
|
- let price = isNaN(priceInt) ? '' : priceInt;
|
|
|
|
|
- let realSales = arr1[i].querySelector('[class^=sale-area]') ? arr1[i].querySelector('[class^=sale-area]').innerText : '';
|
|
|
|
|
- let mainPic = arr1[i].querySelector('[class^=photo] img') ? arr1[i].querySelector('[class^=photo] img').src : '';
|
|
|
|
|
- let shopNameText = document.querySelector('a[class^=shop-name]') ? document.querySelector('a[class^=shop-name]').innerText : document.querySelector('a[class^=slogo-shopname]') ? document.querySelector('a[class^=slogo-shopname]').innerText : '';
|
|
|
|
|
- let shopUrl = document.querySelector('a[class^=shop-name]') ? document.querySelector('a[class^=shop-name]').href : document.querySelector('a[class^=slogo-shopname]') ? document.querySelector('a[class^=slogo-shopname]').href : '';
|
|
|
|
|
-
|
|
|
|
|
- let info = {
|
|
|
|
|
- id: id,
|
|
|
|
|
- title: title,
|
|
|
|
|
- href: href,
|
|
|
|
|
- price: price,
|
|
|
|
|
- realSales: realSales,
|
|
|
|
|
- shopNameText: shopNameText,
|
|
|
|
|
- shopUrl: shopUrl,
|
|
|
|
|
- mainPic: mainPic
|
|
|
|
|
|
|
+ let length = arr1.length-comboLen;
|
|
|
|
|
+ for(let i=0; i<length; i++){
|
|
|
|
|
+ let href = arr1[i].querySelector('[class^=photo] a').href;
|
|
|
|
|
+ let id = arr1[i].dataset.id;
|
|
|
|
|
+ let title = arr1[i].querySelector('[class^=item-name]') ? arr1[i].querySelector('[class^=item-name]').innerText : '淘宝商品'+new Date().getTime();
|
|
|
|
|
+ let priceInt = arr1[i].querySelector('[class^=c-price]') ? arr1[i].querySelector('[class^=c-price]').innerText : 0;
|
|
|
|
|
+ let price = isNaN(priceInt) ? '' : priceInt;
|
|
|
|
|
+ let realSales = arr1[i].querySelector('[class^=sale-area]') ? arr1[i].querySelector('[class^=sale-area]').innerText : '';
|
|
|
|
|
+ let mainPic = arr1[i].querySelector('[class^=photo] img') ? arr1[i].querySelector('[class^=photo] img').src : '';
|
|
|
|
|
+ let shopNameText = document.querySelector('a[class^=shop-name]') ? document.querySelector('a[class^=shop-name]').innerText : document.querySelector('a[class^=slogo-shopname]') ? document.querySelector('a[class^=slogo-shopname]').innerText : '';
|
|
|
|
|
+ let shopUrl = document.querySelector('a[class^=shop-name]') ? document.querySelector('a[class^=shop-name]').href : document.querySelector('a[class^=slogo-shopname]') ? document.querySelector('a[class^=slogo-shopname]').href : '';
|
|
|
|
|
+
|
|
|
|
|
+ let info = {
|
|
|
|
|
+ id: id,
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ href: href,
|
|
|
|
|
+ price: price,
|
|
|
|
|
+ realSales: realSales,
|
|
|
|
|
+ shopNameText: shopNameText,
|
|
|
|
|
+ shopUrl: shopUrl,
|
|
|
|
|
+ mainPic: mainPic
|
|
|
|
|
+ }
|
|
|
|
|
+ outObj.urls.push(info);
|
|
|
}
|
|
}
|
|
|
- outObj.urls.push(info);
|
|
|
|
|
- }
|
|
|
|
|
- let nextHandle = document.querySelectorAll('[class*=pagination-mini] a')[1];
|
|
|
|
|
- if(nextHandle){
|
|
|
|
|
- nextHandle.click({force: true});
|
|
|
|
|
- }else{
|
|
|
|
|
- nextHandle = document.querySelector('a[class^=ui-page-s-next]');
|
|
|
|
|
|
|
+ let nextHandle = document.querySelectorAll('[class*=pagination-mini] a')[1];
|
|
|
if(nextHandle){
|
|
if(nextHandle){
|
|
|
nextHandle.click({force: true});
|
|
nextHandle.click({force: true});
|
|
|
|
|
+ }else{
|
|
|
|
|
+ nextHandle = document.querySelector('a[class^=ui-page-s-next]');
|
|
|
|
|
+ if(nextHandle){
|
|
|
|
|
+ nextHandle.click({force: true});
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return outObj;
|
|
|
|
|
+ }, currentPage, totalPage, itemTitle, typeStr);
|
|
|
|
|
|
|
|
- return outObj;
|
|
|
|
|
- }, currentPage, totalPage, itemTitle, typeStr);
|
|
|
|
|
-
|
|
|
|
|
- if(typeStr != 'alibaba'){
|
|
|
|
|
this.tbList.push(imgInfo);
|
|
this.tbList.push(imgInfo);
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ let nextBtn = await page.$x("//button[contains(text(), '下一页 >')]");
|
|
|
if(nextBtn && nextBtn.length > 0){
|
|
if(nextBtn && nextBtn.length > 0){
|
|
|
nextBtn[0].click({force: true});
|
|
nextBtn[0].click({force: true});
|
|
|
}
|
|
}
|
|
@@ -1764,7 +1771,7 @@
|
|
|
let arr1 = document.querySelectorAll('[class*=goodsContainer]>div');
|
|
let arr1 = document.querySelectorAll('[class*=goodsContainer]>div');
|
|
|
for(let i=0; i< arr1.length; i++){
|
|
for(let i=0; i< arr1.length; i++){
|
|
|
let sku = arr1[i].dataset.sku || '';
|
|
let sku = arr1[i].dataset.sku || '';
|
|
|
- let title = arr1[i].querySelector('[class*=goods_title]') ? arr1[i].querySelector('[class*=goods_title]').innerText : '京东商品'+new Date().getTime();
|
|
|
|
|
|
|
+ let title = arr1[i].querySelector('[class*=goods_title]') ? arr1[i].querySelector('[class*=goods_title]').innerText : '';
|
|
|
let priceText = arr1[i].querySelector('[class*=price]') ? arr1[i].querySelector('[class*=price]').innerText : '';
|
|
let priceText = arr1[i].querySelector('[class*=price]') ? arr1[i].querySelector('[class*=price]').innerText : '';
|
|
|
let price = priceText.replace('¥', '').replaceAll('\n', '');
|
|
let price = priceText.replace('¥', '').replaceAll('\n', '');
|
|
|
let realDom = arr1[i].querySelector('[class*=goods_volume]');
|
|
let realDom = arr1[i].querySelector('[class*=goods_volume]');
|
|
@@ -1783,7 +1790,11 @@
|
|
|
shopUrl: shopUrl,
|
|
shopUrl: shopUrl,
|
|
|
mainPic: mainPic
|
|
mainPic: mainPic
|
|
|
}
|
|
}
|
|
|
- outObj.urls.push(info);
|
|
|
|
|
|
|
+ if(!sku && !title && !shopNameText){
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
|
|
+ outObj.urls.push(info);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
let nextHandle = document.querySelectorAll('[class*=quick-result] [class*=quick-num]');
|
|
let nextHandle = document.querySelectorAll('[class*=quick-result] [class*=quick-num]');
|
|
|
if(nextHandle && nextHandle.length > 0){
|
|
if(nextHandle && nextHandle.length > 0){
|