summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/instagram_task.ts8
-rw-r--r--src/tiktok_task.ts22
2 files changed, 24 insertions, 6 deletions
diff --git a/src/instagram_task.ts b/src/instagram_task.ts
index 5777a56..4b66b1d 100644
--- a/src/instagram_task.ts
+++ b/src/instagram_task.ts
@@ -29,8 +29,8 @@ export const runDownloadInstagramTask = async (task: InstagramTask) => {
});
await page.goto("https://snapinsta.app/");
- await page.type("input#url", task.url);
- await page.click("button[type=submit]");
+ await page.type("input#sf_url", task.url);
+ await page.click("button#sf_submit");
try {
const consent = await page.waitForSelector("button.fc-cta-consent", {
@@ -82,7 +82,7 @@ export const runDownloadInstagramTask = async (task: InstagramTask) => {
const downloadButton = await page.waitForSelector(
".download-content a[data-event=click_download_btn]",
- { timeout: 10_000 }
+ { timeout: 10_000 },
);
if (!downloadButton) {
throw new Error("Could not find download button");
@@ -98,7 +98,7 @@ export const runDownloadInstagramTask = async (task: InstagramTask) => {
// Click outside shadow-dommed ad modal to close it and start the download
console.log(
- "Clicking outside the possible ad modal to close it and start the download"
+ "Clicking outside the possible ad modal to close it and start the download",
);
await page.mouse.click(10, 10);
diff --git a/src/tiktok_task.ts b/src/tiktok_task.ts
index 7e85c5c..15e30e0 100644
--- a/src/tiktok_task.ts
+++ b/src/tiktok_task.ts
@@ -46,8 +46,26 @@ export const runDownloadTiktokTask = async (task: TikTokTask) => {
}
}
+ try {
+ const cont = await page.waitForSelector("button.continue-web", {
+ timeout: 3000,
+ });
+ if (cont) {
+ console.log(
+ "Looks like a 'continue using the web' dialog, clicking continue",
+ );
+ await cont.click();
+ }
+ } catch (e) {
+ if (e instanceof TimeoutError) {
+ console.log("No 'continue using the web' dialog found");
+ } else {
+ throw e;
+ }
+ }
+
await page.type("input#url", task.url);
- await page.click("button[type=submit]");
+ await page.click('button[type="submit"]');
console.log("Waiting for a bit");
await wait(1000);
@@ -83,7 +101,7 @@ export const runDownloadTiktokTask = async (task: TikTokTask) => {
const downloadButton = await page.waitForSelector(
"a[data-event=server01_file]",
- { timeout: 10_000 }
+ { timeout: 10_000 },
);
if (!downloadButton) {
throw new Error("Could not find download button");