|
|
|
@ -463,6 +463,7 @@ module.exports = class BingAuto2 {
|
|
|
|
for (let i = 0; i < searchCnt; i++) {
|
|
|
|
for (let i = 0; i < searchCnt; i++) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
console.log(`Search ${i + 1}/${searchCnt} : ${keywords[i]}`);
|
|
|
|
console.log(`Search ${i + 1}/${searchCnt} : ${keywords[i]}`);
|
|
|
|
|
|
|
|
await page.waitForSelector('#sb_form_q');
|
|
|
|
let searchBar = await page.$('#sb_form_q');
|
|
|
|
let searchBar = await page.$('#sb_form_q');
|
|
|
|
// clear
|
|
|
|
// clear
|
|
|
|
await searchBar.click({clickCount: 3});
|
|
|
|
await searchBar.click({clickCount: 3});
|
|
|
|
@ -502,9 +503,12 @@ module.exports = class BingAuto2 {
|
|
|
|
async doAllSearch() {
|
|
|
|
async doAllSearch() {
|
|
|
|
let searchStatus = await this.checkSearchStatus();
|
|
|
|
let searchStatus = await this.checkSearchStatus();
|
|
|
|
console.log('> Search status:', searchStatus);
|
|
|
|
console.log('> Search status:', searchStatus);
|
|
|
|
|
|
|
|
let point_per_search = 5;
|
|
|
|
|
|
|
|
if (Object.keys(searchStatus).length === 2)
|
|
|
|
|
|
|
|
point_per_search = 3;
|
|
|
|
|
|
|
|
|
|
|
|
for (let searchType in searchStatus) {
|
|
|
|
for (let searchType in searchStatus) {
|
|
|
|
let searchCnt = Math.floor((searchStatus[searchType][1] - searchStatus[searchType][0]) / 5);
|
|
|
|
let searchCnt = Math.floor((searchStatus[searchType][1] - searchStatus[searchType][0]) / point_per_search);
|
|
|
|
if (searchCnt !== 0) {
|
|
|
|
if (searchCnt !== 0) {
|
|
|
|
console.log('>', searchType, 'search');
|
|
|
|
console.log('>', searchType, 'search');
|
|
|
|
let page = await this.newPage(searchType);
|
|
|
|
let page = await this.newPage(searchType);
|
|
|
|
|