Created
January 27, 2014 16:15
-
-
Save RReverser/8651559 to your computer and use it in GitHub Desktop.
Report Twitter spam automatically on search page
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
var reportedHash = 'reported' in localStorage ? JSON.parse(localStorage.reported) : {}; | |
(function reportTweets() { | |
var newTweetsBar = document.querySelector('.new-tweets-bar'); | |
newTweetsBar && newTweetsBar.click(); | |
Array.prototype.map.call( | |
document.querySelectorAll('.original-tweet'), | |
function (tweet) { | |
return tweet.dataset | |
} | |
).filter(function (tweet) { | |
return !(tweet.tweetId in reportedHash); | |
}).forEach(function (tweet) { | |
reportedHash[tweet.tweetId] = true; | |
$.post('/i/tweet/report', { | |
authenticity_token: '...your token (look in Network Tab)...', | |
block_user: 'false', | |
report_type: 'spam', | |
screen_name: tweet.screenName, | |
tweet_id: tweet.tweetId, | |
user_id: tweet.userId | |
}); | |
}); | |
localStorage.reported = JSON.stringify(reportedHash); | |
setTimeout(reportTweets, 10000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment