email worker
This commit is contained in:
parent
241b7a8712
commit
05fcdc0b12
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -61,7 +61,7 @@ export const puppeteerLoader = async (url: string, headless: boolean, location:
|
||||
url,
|
||||
{
|
||||
launchOptions: {
|
||||
headless: headless,
|
||||
headless: false,
|
||||
ignoreHTTPSErrors: true
|
||||
},
|
||||
|
||||
@ -93,13 +93,11 @@ export const puppeteerLoader = async (url: string, headless: boolean, location:
|
||||
// Poll for cancellation
|
||||
while (!isFinished) {
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
logger.info('Checking cancellation for ' + url);
|
||||
if (await checkCancelled()) {
|
||||
const browser = await getBrowser();
|
||||
if (browser) {
|
||||
const pid = browser.process()?.pid;
|
||||
logger.info(`Cancellation confirmed for process ${pid}`);
|
||||
// await browser.close(); // Do not close shared browser
|
||||
}
|
||||
|
||||
reject(new Error('CancelledByUser'));
|
||||
@ -212,7 +210,6 @@ export const findEmailEach = async (location: LocalResult, opts: { headless?: bo
|
||||
|
||||
page.status = 'SEARCHING_EMAIL'
|
||||
try {
|
||||
logger.info(`Scraping email from ${page.url}`)
|
||||
const pageEmails = await findEMail('find email', page.url, opts, location)
|
||||
if (pageEmails && Array.isArray(pageEmails)) {
|
||||
emails.push(...pageEmails)
|
||||
|
||||
@ -112,8 +112,6 @@ export const parseHtml = async (url: string, config: AxiosRequestConfig | null,
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[ParseHtml] Successfully fetched ${url}, content length: ${content.length}`);
|
||||
|
||||
const $ = cheerio.load(content)
|
||||
const og: Og = {}
|
||||
const meta: Meta = {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user