Skip to content

Instantly share code, notes, and snippets.

@bennettscience
Created October 15, 2015 19:16
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 bennettscience/cefbc00052c5b5d5ec67 to your computer and use it in GitHub Desktop.
Save bennettscience/cefbc00052c5b5d5ec67 to your computer and use it in GitHub Desktop.
Reports Twitter spam from a Google Sheet archive.
function reportSpam() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Archive');
var range = sheet.getRange(2, 1,sheet.getLastRow(), sheet.getLastColumn());
var cells = range.getValues();
// Loop through the range where [i] is the ROW
for(var i=0;i<cells.length;i++) {
// Look for profile ID's matching spam websites
if(cells[i][17] == "mmsg.net") {
// Grab the User ID and Username from the archive
var id = cells[i][0].toString();
var user = cells[i][1].toString();
// Post to the Twitter REST API to report spam.
TwtrService.post("https://api.twitter.com/1.1/users/report_spam.json?screen_name=" + user + "&user_id=" + id);
Logger.log('Spam reported for ' + user);
} else {
Logger.log('Not spam');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment