diff --git a/src/commands/highlight.ts b/src/commands/highlight.ts index c431cd6..5d2aa0a 100644 --- a/src/commands/highlight.ts +++ b/src/commands/highlight.ts @@ -89,8 +89,8 @@ export async function detectFiles(browser: Browser, page: Page, highlight: strin await page.click("svg[aria-label='Pause']"); var urls: string[] = []; await page.waitForSelector("div.qbCDp", {visible: true}); - const imageURL = (await page.$$eval("img.y-yJ5", images => images.map(image => image.getAttribute("src"))))[0]; - if (imageURL) urls.push(imageURL); + const imageURL = (await page.$$eval("img.y-yJ5", images => images.map(image => image.getAttribute("srcset"))))[0]; + if (imageURL) urls.push(imageURL.split(" ")[0]); const videoURL = (await page.$$eval("video > source", sources => sources.map(source => source.getAttribute("src"))))[0]; if (videoURL) urls.push(videoURL); return { urls, username }; diff --git a/src/commands/story.ts b/src/commands/story.ts index bec2fcf..aa264dd 100644 --- a/src/commands/story.ts +++ b/src/commands/story.ts @@ -83,8 +83,8 @@ export async function detectFiles(browser: Browser, page: Page, user: string, it await page.click("svg[aria-label='Pause']"); var urls: string[] = []; await page.waitForSelector("div.qbCDp", {visible: true}); - const imageURL = (await page.$$eval("img.y-yJ5", images => images.map(image => image.getAttribute("src"))))[0]; - if (imageURL) urls.push(imageURL); + const imageURL = (await page.$$eval("img.y-yJ5", images => images.map(image => image.getAttribute("srcset"))))[0]; + if (imageURL) urls.push(imageURL.split(" ")[0]); const videoURL = (await page.$$eval("video > source", sources => sources.map(source => source.getAttribute("src"))))[0]; if (videoURL) urls.push(videoURL); return { username: user, urls };