update gb2312

This commit is contained in:
theluyuan 2022-02-01 16:31:29 +08:00
parent 21533025ba
commit 62eea37625
6 changed files with 57 additions and 169 deletions

View File

@ -5,7 +5,7 @@ find = require("./find")
imglist = require("./picture")
section = require("./section")
let name = "扑飞漫画"
let version = "21.06.27"
let version = "22.02.01"
let type = 1
module.exports = {
name,

View File

@ -1,87 +1,23 @@
const puppeteer = require('puppeteer');
const urlencode = require('urlencode-gb2312-ignore');
const cheerio = require('cheerio')
let axios = require('axios')
var iconv = require('iconv-lite')
let mainurl = "http://www.pufei.cc"
let gethtml = (name) => {
return new Promise(async (res, rej) => {
puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
}).then(async (browser) => {
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'webdriver', { get: ()=> false });
});
try {
await page.goto(mainurl);
} catch (error) {
browser.close()
res([])
}
await page.click(".searchtext1")
await page.type(".searchtext1", name);
// const usernameValue = await page.$eval(".searchtext1", el => el.value);
await page.click("#btnSend1")
let openpages = []
let num = 0;
let set = setInterval(async () => {
await browser.pages().then((res) => {
// console.log(res.length)
openpages = res
})
try {
await openpages[2].content().then((r) => {
// console.log(r)
if (r.indexOf("没有搜索到相关的内容") != -1 || r.indexOf("您当前的位置") != -1) {
// console.log(r)
res(r)
clearInterval(set)
browser.close()
} else {
throw error;
}
})
} catch (error) {
num++
// console.log(num)
if (num > 10) {
res([])
clearInterval(set)
browser.close()
}
// console.log(err)
// res([])
}
}, 500);
// setTimeout(async () => {
// await browser.pages().then((res) => {
// // console.log(res.length)
// openpages = res
// })
// try {
// await openpages[2].content().then((r) => {
// // console.log(r)
// res(r)
// })
// browser.close()
// } catch (error) {
// res([])
// browser.close()
// }
// // console.log(a)
// // await page.content().then((r)=>{
// // res(r)
// // })
// }, 2000);
name = urlencode(name,"gb2312")
let seach = `orderby=1&myorder=1&tbname=mh&tempid=3&show=title%2Cplayer%2Cplayadmin%2Cbieming%2Cpinyin&keyboard=${name}&Submit=%CB%D1%CB%F7%C2%FE%BB%AD`
axios.post(mainurl + "/e/search/index.php",seach,{
headers:{
"Content-Type": "application/x-www-form-urlencoded"
},
responseType: "arraybuffer"
}).then((r)=>{
// console.log(r.data)
// res(r.data)
r.data = iconv.decode(r.data,"gb2312")
res(r.data)
})
})
}
@ -119,9 +55,7 @@ let get = (name) => {
}
list.push(l)
})
// console.log(list)
list = { name: "扑飞漫画", list }
res(list);
} catch (error) {
rej([])

View File

@ -5,7 +5,7 @@ find = require("./find")
imglist = require("./picture")
section = require("./section")
let name = "塔多漫画"
let version = "20.01.02"
let version = "22.02.01"
let type = 1
module.exports = {
name,

View File

@ -1,81 +1,22 @@
const puppeteer = require('puppeteer');
const urlencode = require('urlencode-gb2312-ignore');
const cheerio = require('cheerio')
let mainurl = "http://www.taduo.net/"
let axios = require('axios')
var iconv = require('iconv-lite')
let mainurl = "https://www.taduo.net"
let gethtml = (name) => {
return new Promise(async (res, rej) => {
puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
}).then(async (browser) => {
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'webdriver', { get: ()=> false });
});
// await page.goto(mainurl);
try {
await page.goto(mainurl);
} catch (error) {
console.log("err")
browser.close()
res([])
}
await page.type(".searchtext1", name);
// const usernameValue = await page.$eval(".searchtext1", el => el.value);
await page.click("#btnSend1")
let openpages = []
let num = 0;
let set = setInterval(async () => {
await browser.pages().then((res) => {
// console.log(res.length)
openpages = res
})
try {
await openpages[2].content().then((r) => {
// console.log(r)
if(r.indexOf("没有搜索到相关的内容") != -1 || r.indexOf("您当前的位置") !=-1){
res(r)
clearInterval(set)
browser.close()
}else{
throw error;
}
})
} catch (error) {
num++
// console.log(num)
if(num > 10){
res([])
clearInterval(set)
browser.close()
}
// console.log(err)
// res([])
}
}, 500);
// setTimeout(async () => {
// await browser.pages().then((res) => {
// // console.log(res.length)
// openpages = res
// })
// try {
// await openpages[2].content().then((r) => {
// res(r)
// })
// browser.close()
// } catch (error) {
// res([])
// browser.close()
// }
// }, 1500);
name = urlencode(name,"gb2312")
let seach = `orderby=1&myorder=1&tbname=mh&tempid=3&show=title%2Cplayer%2Cplayadmin%2Cbieming%2Cpinyin&keyboard=${name}&Submit=%CB%D1%CB%F7`
axios.post(mainurl + "/e/search/index.php",seach,{
headers:{
"Content-Type": "application/x-www-form-urlencoded"
},
responseType: "arraybuffer"
}).then((r)=>{
// console.log(r.data)
// res(r.data)
r.data = iconv.decode(r.data,"gb2312")
res(r.data)
})
})
}
@ -113,9 +54,7 @@ let get = (name) => {
}
list.push(l)
})
// console.log(list)
list = {name:"塔多漫画",list}
res(list);
} catch (error) {
rej([])

View File

@ -12,7 +12,7 @@
"axios": "^0.19.0",
"cheerio": "^1.0.0-rc.3",
"fs": "^0.0.1-security",
"iconv-lite": "^0.5.0",
"iconv-lite": "^0.6.3",
"koa": "^2.11.0",
"koa-bodyparser": "^4.2.1",
"koa-router": "^7.4.0",
@ -22,6 +22,7 @@
"querystring": "^0.2.0",
"request": "^2.88.0",
"superagent": "^5.1.2",
"urlencode-gb2312-ignore": "^1.0.3",
"webp-batch-convert": "^0.0.8"
}
}

View File

@ -1309,19 +1309,19 @@ https-proxy-agent@^4.0.0:
agent-base "5"
debug "4"
iconv-lite@0.4.24:
iconv-lite@0.4.24, iconv-lite@~0.4.11:
version "0.4.24"
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
dependencies:
safer-buffer ">= 2.1.2 < 3"
iconv-lite@^0.5.0:
version "0.5.2"
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz#af6d628dccfb463b7364d97f715e4b74b8c8c2b8"
integrity sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==
iconv-lite@^0.6.3:
version "0.6.3"
resolved "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501"
integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==
dependencies:
safer-buffer ">= 2.1.2 < 3"
safer-buffer ">= 2.1.2 < 3.0.0"
indent-string@^2.1.0:
version "2.1.0"
@ -2472,7 +2472,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
@ -2905,6 +2905,20 @@ url-regex@^3.0.0:
dependencies:
ip-regex "^1.0.1"
urlencode-gb2312-ignore@^1.0.3:
version "1.0.3"
resolved "https://registry.npmmirror.com/urlencode-gb2312-ignore/-/urlencode-gb2312-ignore-1.0.3.tgz#348e7825e4b003a3e5a26b896b46b728caff03f8"
integrity sha512-R99yobFi3OLI6JJXA9jMItTRLU1HYIV4VkUpygLcwKM3DMf9NT6Hebsw6RBXvDZ7RDHFJO8ik+DeNbFYgO5MIw==
dependencies:
urlencode "^1.1.0"
urlencode@^1.1.0:
version "1.1.0"
resolved "https://registry.npmmirror.com/urlencode/-/urlencode-1.1.0.tgz#1f2ba26f013c85f0133f7a3ad6ff2730adf7cbb7"
integrity sha512-OOAOh9owHXr/rCN1tteSnYwIvsrGHamSz0hafMhmQa7RcS4+Ets6/2iVClVGjt9jkDW84UqoMw/Gmpc7QolX6A==
dependencies:
iconv-lite "~0.4.11"
util-deprecate@^1.0.1, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"