summaryrefslogtreecommitdiffstats
path: root/src/instagram_task.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/instagram_task.ts')
-rw-r--r--src/instagram_task.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/instagram_task.ts b/src/instagram_task.ts
index bea1e38..4e31518 100644
--- a/src/instagram_task.ts
+++ b/src/instagram_task.ts
@@ -1,6 +1,7 @@
import fs from "fs";
import puppeteer, { TimeoutError } from "puppeteer";
import { wait } from "./utils";
+import { getBrowser } from "./browser";
export interface InstagramTask {
type: "download_instagram";
@@ -10,10 +11,7 @@ export interface InstagramTask {
}
export const runDownloadInstagramTask = async (task: InstagramTask) => {
- const browser = await puppeteer.launch({
- headless: false,
- args: ["--shm-size=1gb"],
- });
+ const browser = await getBrowser();
const page = await browser.newPage();
const client = await page.createCDPSession();
await client.send("Page.setDownloadBehavior", {
@@ -126,6 +124,5 @@ export const runDownloadInstagramTask = async (task: InstagramTask) => {
await task.respondWithFile(`./downloads/${downloadedFile}`);
} finally {
await page.close();
- await browser.close();
}
};