-
-
Save banteg/ace08214938dd6cfc948d4c8be6ac2a4 to your computer and use it in GitHub Desktop.
arc boost to report spam on twitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let actionsInProgress = false; | |
function waitForElement(selector) { | |
return new Promise((resolve) => { | |
const checkInterval = setInterval(() => { | |
const element = document.querySelector(selector); | |
if (element) { | |
clearInterval(checkInterval); | |
resolve(element); | |
} | |
}, 100); | |
}); | |
} | |
async function performActions() { | |
if (actionsInProgress) return; | |
try { | |
actionsInProgress = true; | |
let element = await waitForElement( | |
'[data-testid="OCF_CallToAction_Button"]' | |
); | |
console.log("reporting"); | |
element.click(); | |
element = await waitForElement('[aria-posinset="3"]'); | |
element.click(); | |
element = await waitForElement('[data-testid="ChoiceSelectionNextButton"]'); | |
element.click(); | |
element = await waitForElement('[aria-posinset="3"]'); | |
element.click(); | |
element = await waitForElement('[data-testid="ChoiceSelectionNextButton"]'); | |
element.click(); | |
element = await waitForElement('[role="radiogroup"] > div > label'); | |
element.click(); | |
element = await waitForElement('[data-testid="ChoiceSelectionNextButton"]'); | |
element.click(); | |
element = await waitForElement('[data-testid="ocfSettingsListNextButton"]'); | |
element.click(); | |
element = await waitForElement('[data-testid="ocfSettingsListNextButton"]'); | |
element.click(); | |
element = await waitForElement('[data-viewportview="true"] [role="button"]:last-of-type') | |
element.click(); | |
console.log("click submit"); | |
} catch (error) { | |
console.error(error); | |
} finally { | |
actionsInProgress = false; | |
} | |
} | |
document.addEventListener("DOMContentLoaded", () => { | |
setInterval(performActions, 1000); | |
}); |
twitter rolled out a short 1-step form today. if you have it, use this version.
let actionsInProgress = false;
function waitForElement(selector) {
return new Promise((resolve) => {
const checkInterval = setInterval(() => {
const element = document.querySelector(selector);
if (element) {
clearInterval(checkInterval);
resolve(element);
}
}, 100);
});
}
async function performActions() {
if (actionsInProgress) return;
try {
actionsInProgress = true;
let next_button = await waitForElement(
'[data-testid="ChoiceSelectionNextButton"]'
);
console.log("reporting");
let spam = await waitForElement('[aria-posinset="6"]');
spam.click();
next_button.click();
let block = await waitForElement('[data-viewportview="true"] [role="button"]:last-of-type')
block.click();
} catch (error) {
console.error(error);
} finally {
actionsInProgress = false;
}
}
document.addEventListener("DOMContentLoaded", () => {
setInterval(performActions, 200);
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tampermonkey port https://gist.github.com/apoorvlathey/bcc49f84e8f092d7e5d660c55129d13a