Skip to content

Commit

Permalink
fix(frontend): Strip tracking info from URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronBenDaniel authored and TheOnlyWayUp committed Dec 1, 2024
1 parent f40d1e4 commit c1db7ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
if (input_url.includes("/story/")) {
// https://wattpad.com/story/237369078-wattpad-books-presents
input_url = input_url.split("-")[0].split("/story/")[1]; // removes tracking fields and title
input_url = input_url.split("-")[0].split("?")[0].split("/story/")[1]; // removes tracking fields and title
download_id = input_url;
mode = "story";
} else if (input_url.includes("/stories/")) {
Expand All @@ -51,7 +51,7 @@
mode = "story";
} else {
// https://www.wattpad.com/939051741-wattpad-books-presents-the-qb-bad-boy-and-me
input_url = input_url.split("-")[0].split("wattpad.com/")[1]; // removes tracking fields and title
input_url = input_url.split("-")[0].split("?")[0].split("wattpad.com/")[1]; // removes tracking fields and title
download_id = input_url;
if (/^\d+$/.test(download_id)) {
// If "wattpad.com/{download_id}" contains only numbers
Expand Down

0 comments on commit c1db7ba

Please sign in to comment.