Skip to content

Instantly share code, notes, and snippets.

@seth-macpherson
Created April 7, 2025 06:27
Show Gist options
  • Save seth-macpherson/38392afa57d49d42c2aef0dd2a1e1ddc to your computer and use it in GitHub Desktop.
Save seth-macpherson/38392afa57d49d42c2aef0dd2a1e1ddc to your computer and use it in GitHub Desktop.
Remove Watchlist
// Copy the contents of this file into the browser console from the Plex Web App
// This will remove all items from your watchlist
const links = document.querySelectorAll('a[aria-label][href][role="link"]');
let index = 0;
function hoverNextLink() {
if (index < links.length) {
const link = links[index];
const url = decodeURIComponent(link.getAttribute("href").split("&")[0]);
const keyId = url.split("/").pop();
removeFromWatchlist(keyId);
index++;
setTimeout(hoverNextLink, 50); // Pause for 0.5 seconds
}
}
hoverNextLink();
function removeFromWatchlist(keyId) {
fetch(
`https://discover.provider.plex.tv/actions/removeFromWatchlist?ratingKey=${keyId}`,
{
headers: {
accept: "*/*",
"accept-language": "en-US,en;q=0.9",
"cache-control": "no-cache",
pragma: "no-cache",
priority: "u=1, i",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
Referer: "https://sojourner/",
"Referrer-Policy": "strict-origin-when-cross-origin",
},
body: null,
method: "OPTIONS",
}
);
fetch(
`https://discover.provider.plex.tv/actions/removeFromWatchlist?ratingKey=${keyId}`,
{
headers: {
accept: "application/json, text/plain, */*",
"accept-language": "en",
"cache-control": "no-cache",
pragma: "no-cache",
priority: "u=1, i",
"sec-ch-ua":
'"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"macOS"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"x-plex-client-identifier": "4ocjm47y4tcxr1m0wha8vp1c",
"x-plex-device": "OSX",
"x-plex-device-screen-resolution": "1070x958,1728x1117",
"x-plex-drm": "widevine",
"x-plex-features": "external-media,indirect-media,hub-style-list",
"x-plex-language": "en",
"x-plex-model": "bundled",
"x-plex-platform": "Chrome",
"x-plex-platform-version": "133.0",
"x-plex-product": "Plex Web",
"x-plex-provider-version": "7.2",
"x-plex-restriction-profile": "undefined",
"x-plex-text-format": "plain",
"x-plex-token": "VgJx3yh4kAbUbEWoTiM9",
"x-plex-version": "4.141.0",
},
referrer: "https://sojourner/",
referrerPolicy: "strict-origin-when-cross-origin",
body: null,
method: "PUT",
mode: "cors",
credentials: "omit",
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment