add NovelFull (closes #1)
This commit is contained in:
@@ -3,6 +3,7 @@ const cheerio = require("cheerio");
|
||||
const request = require("request");
|
||||
const chromium = require("chrome-aws-lambda");
|
||||
const puppeteer = require("puppeteer");
|
||||
const { scraper } = require("../../helper");
|
||||
|
||||
const baseUrl = "https://www.wuxiaworld.com/";
|
||||
|
||||
@@ -10,18 +11,7 @@ const router = express.Router();
|
||||
|
||||
router.get("/novels/", async (req, res) => {
|
||||
let url = `https://www.wuxiaworld.com/novels`;
|
||||
const browser = await puppeteer.launch({
|
||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
||||
defaultViewport: chromium.defaultViewport,
|
||||
executablePath: await chromium.executablePath,
|
||||
headless: true,
|
||||
ignoreHTTPSErrors: true,
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(url);
|
||||
|
||||
const body = await page.content();
|
||||
const body = await scraper(url);
|
||||
|
||||
let novels = [];
|
||||
|
||||
@@ -51,18 +41,7 @@ router.get("/novels/", async (req, res) => {
|
||||
router.get("/novel/:novelUrl", async (req, res) => {
|
||||
let novelUrl = req.params.novelUrl;
|
||||
let url = `${baseUrl}novel/${novelUrl}/`;
|
||||
const browser = await puppeteer.launch({
|
||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
||||
defaultViewport: chromium.defaultViewport,
|
||||
executablePath: await chromium.executablePath,
|
||||
headless: true,
|
||||
ignoreHTTPSErrors: true,
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(url);
|
||||
|
||||
const body = await page.content();
|
||||
const body = await scraper(url);
|
||||
|
||||
const $ = cheerio.load(body);
|
||||
|
||||
@@ -130,18 +109,7 @@ router.get("/novel/:novelUrl/:chapterUrl", async (req, res) => {
|
||||
|
||||
const novelUrl = `${req.params.novelUrl}/`;
|
||||
const chapterUrl = `${req.params.chapterUrl}/`;
|
||||
const browser = await puppeteer.launch({
|
||||
args: [...chromium.args, "--hide-scrollbars", "--disable-web-security"],
|
||||
defaultViewport: chromium.defaultViewport,
|
||||
executablePath: await chromium.executablePath,
|
||||
headless: true,
|
||||
ignoreHTTPSErrors: true,
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(url);
|
||||
|
||||
const body = await page.content();
|
||||
const body = await scraper(url);
|
||||
|
||||
const $ = cheerio.load(body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user