我正在尝试抓取一个无限滚动的网站。
我正在控制滚动,但它仍然在到达网页末尾后退出。
这是我的代码:
const puppeteer = require("puppeteer");
module.exports.scraper = async (url, callBack) => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.setUserAgent(
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
);
await page.setViewport({ width: 1200, height: 768 });
function wait(ms) {
return new Promise((resolve) => setTimeout(() => resolve(), ms));
}
await page.goto(`${url}/products/?department=men&l2_category=polos-t-shirts`, {
waitUntil: "networkidle0",
});
// Get the height of the rendered page
const bodyHandle = await page.$("body");
const { …Run Code Online (Sandbox Code Playgroud) 我读过许多关于多个托管平台上共享托管的文章。但我仍然想确定我可以在托管商的共享托管计划上托管 React 和 NodeJS 项目吗?
或者有人可以建议我一个更好的托管,我使用 MySQL 作为数据库。