MCPcopy Create free account
hub / github.com/Revadike/Misc-JavaScript-Projects / fixWatchDate

Function fixWatchDate

Trakt.tv - Bulk Change Watch Date.js:7–51  ·  view source on GitHub ↗
(type, url, id)

Source from the content-addressed store, hash-verified

5let csrfToken = "";
6
7async function fixWatchDate(type, url, id) {
8 await fetch(url + "/watch/remove", {
9 "headers": {
10 "accept": "*/*",
11 "accept-language": "en",
12 "cache-control": "no-cache",
13 "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
14 "pragma": "no-cache",
15 "sec-fetch-dest": "empty",
16 "sec-fetch-mode": "cors",
17 "sec-fetch-site": "same-origin",
18 "sec-gpc": "1",
19 "x-csrf-token": csrfToken,
20 "x-requested-with": "XMLHttpRequest"
21 },
22 "referrer": "https://trakt.tv/users/" + username + "/history",
23 "referrerPolicy": "strict-origin-when-cross-origin",
24 "body": "type=" + type + "&trakt_id=" + id,
25 "method": "POST",
26 "mode": "cors",
27 "credentials": "include"
28 });
29 await fetch(url + "/watch", {
30 "headers": {
31 "accept": "*/*",
32 "accept-language": "en",
33 "cache-control": "no-cache",
34 "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
35 "pragma": "no-cache",
36 "sec-fetch-dest": "empty",
37 "sec-fetch-mode": "cors",
38 "sec-fetch-site": "same-origin",
39 "sec-gpc": "1",
40 "x-csrf-token": csrfToken,
41 "x-requested-with": "XMLHttpRequest"
42 },
43 "referrer": "https://trakt.tv/users/" + username + "/history",
44 "referrerPolicy": "strict-origin-when-cross-origin",
45 "body": "type=" + type + "&trakt_id=" + id + "&watched_at=released&collected_at=released&force=false",
46 "method": "POST",
47 "mode": "cors",
48 "credentials": "include"
49 });
50
51}
52
53
54for (let page = 1; page <= lastpage; page++) {

Calls

no outgoing calls

Tested by

no test coverage detected