mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 18:18:06 +08:00
23 lines
672 B
JavaScript
23 lines
672 B
JavaScript
const config = require('../config');
|
|
const puppeteer = require('puppeteer');
|
|
|
|
const options = {
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-infobars', '--window-position=0,0', '--ignore-certifcate-errors', '--ignore-certifcate-errors-spki-list', `--user-agent=${config.ua}`],
|
|
headless: true,
|
|
ignoreHTTPSErrors: true,
|
|
userDataDir: './tmp',
|
|
};
|
|
|
|
module.exports = async () => {
|
|
let browser;
|
|
if (config.puppeteerWSEndpoint) {
|
|
browser = await puppeteer.connect({
|
|
browserWSEndpoint: config.puppeteerWSEndpoint,
|
|
});
|
|
} else {
|
|
browser = await puppeteer.launch(options);
|
|
}
|
|
|
|
return browser;
|
|
};
|