Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function dislike(id) {
- let op = {};
- op.mode = 'no-cors';
- op.method= 'POST';
- op.headers = {'Content-Type': 'application/x-www-form-urlencoded'};
- op.body = 'entry_id=xxx&method=dislikeEntry'.replace('xxx', id);
- url = 'https://contest.com/api?hash=a5a66a44085823cbda';
- return await fetch(url, op);
- }
- const entries = document.querySelectorAll('.cd-entry-label');
- const entry_ids = [];
- entries.forEach(node => entry_ids.push(node.innerText.replace(/[^#]*#/, '')));
- entry_ids.forEach( async id => {
- let r = await dislike(id);
- let j = await r.json();
- console.log(id + ' ' + j.state);
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement