Created
October 15, 2015 19:16
-
-
Save bennettscience/cefbc00052c5b5d5ec67 to your computer and use it in GitHub Desktop.
Reports Twitter spam from a Google Sheet archive.
This file contains 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
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