Skip to content

Instantly share code, notes, and snippets.

@iamntz
Last active March 24, 2020 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamntz/a0489dc5a442fee73842a24bfc2638db to your computer and use it in GitHub Desktop.
Save iamntz/a0489dc5a442fee73842a24bfc2638db to your computer and use it in GitHub Desktop.
Șterge spamul de la 2performant
  1. Deschizi chrome dev tools
  2. Faci orice operațiune ajax în UI 2performant
  3. te duci în tab-ul network
  4. click 2 -> copy -> fetch (atenție, să fie headerele ce includ și adresa de mail)
  5. copiezi tot ce este în header în INSERT_HEADERS_HERE
  6. Posibil să fie nevoie să ajustezi page=1&perpage=100
  7. Paste la tot în consolă.
const HEADERS = {
        "accept": "application/json, text/plain, */*",
            "accept-language": "en-US,en;q=0.9,ro-RO;q=0.8,ro;q=0.7",
            "access-token": "zzzz",
            "cache-control": "no-cache",
            "client": "zzzz",
            "expiry": "1585929920",
            "if-modified-since": "Mon, 26 Jul 1997 05:00:00 GMT",
            "pragma": "no-cache",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-site",
            "token-type": "Bearer",
            "uid": "email sau user"
    }

fetch("https://api.2performant.com/affiliate/programs.json?filter%5Bcountry%5D=where_I_promote&filter%5Brelation%5D=accepted&noFilter=false&noSort=true&page=1&perpage=100", {
....
const HEADERS = INSERT_HEADERS_HERE
fetch("https://api.2performant.com/affiliate/programs.json?filter%5Bcountry%5D=where_I_promote&filter%5Brelation%5D=accepted&noFilter=false&noSort=true&page=1&perpage=100", {
"headers": HEADERS,
"referrer": "https://network.2performant.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
}).then((data) => data.json()).then(data => {
data.programs.forEach(program => {
fetch("https://api.2performant.com/affiliate/programs/" + program.id + "/update_subscription.json", {
"headers": HEADERS,
"referrer": "https://network.2performant.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{\"affrequest\":{\"id\":" + program.id + ",\"subscription\":{\"newsletter\":false,\"notifications\":false,\"advertiser_promotions\":false}}}",
"method": "PUT",
"mode": "cors",
"credentials": "include"
});
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment