-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support parallelize scrapers (#356)
* israeli-bank-scrapers@5.2.0 * patch israeli-bank-scrapers to allow passing a browser context * Use a single browser (and context) for all scrapers * Better logs * Use a separate browser context for each scraper * Move ScraperOptions to own var * Extract `scrapeAccount` * Add option to run parallel scrapers
- Loading branch information
1 parent
11fcffa
commit 0efcc8f
Showing
10 changed files
with
499 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import puppeteer, { | ||
type Browser, | ||
type PuppeteerLaunchOptions, | ||
} from "puppeteer"; | ||
import { createLogger } from "./utils/logger.js"; | ||
|
||
export const browserArgs = ["--disable-dev-shm-usage", "--no-sandbox"]; | ||
export const browserExecutablePath = | ||
process.env.PUPPETEER_EXECUTABLE_PATH || undefined; | ||
|
||
const logger = createLogger("browser"); | ||
|
||
export async function createBrowser(): Promise<Browser> { | ||
const options = { | ||
args: browserArgs, | ||
executablePath: browserExecutablePath, | ||
} satisfies PuppeteerLaunchOptions; | ||
|
||
logger("Creating browser", options); | ||
return puppeteer.launch(options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters