From 6a5cbdb3445f1b21b87f7dafe4d69c3ce2ec321b Mon Sep 17 00:00:00 2001 From: Omair Date: Tue, 18 Jul 2023 16:40:05 -0400 Subject: [PATCH] playstation: remove anchor link from game url --- playstation-plus.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/playstation-plus.js b/playstation-plus.js index 54fab32..473ce90 100644 --- a/playstation-plus.js +++ b/playstation-plus.js @@ -139,7 +139,7 @@ async function signInToPSN() { "playstation-plus: got captcha during login. Please check." ); }) - .catch((_) => {}); + .catch((_) => { }); // handle MFA, but don't await it page.locator('input[title="Enter Code"]') @@ -167,7 +167,7 @@ async function signInToPSN() { .click(); // Trust this Browser await page.click("button.primary-button"); }) - .catch((_) => {}); + .catch((_) => { }); } else { console.log("Waiting for you to login in the browser."); await notify( @@ -206,9 +206,10 @@ async function redeemFreeGames() { .locator(".cta__primary") .getAttribute("href"); // standardize URLs - return urlSlug.charAt(0) === "/" - ? `https://www.playstation.com${urlSlug}` - : urlSlug; + return (urlSlug.charAt(0) === "/" + ? `https://www.playstation.com${urlSlug}` // base url may not be present, add it back + : urlSlug) + .split('#').shift(); // url may have anchor tag, remove it }) ); console.log("Free games:", monthlyGamesPageLinks);