Skip to content

Instantly share code, notes, and snippets.

@broquaint
Created September 3, 2015 10:07
Show Gist options
  • Save broquaint/5861d1bd475dc4e4824a to your computer and use it in GitHub Desktop.
Save broquaint/5861d1bd475dc4e4824a to your computer and use it in GitHub Desktop.
Unfavourite all favourited tweets currently on your favourites page
// Usage:
// 1. Go to https://twitter.com/favorites in a browser that supports ES6
// 2. Open local equivalent of the JS console
// 3. Run this code.
function unfavourite(tweet) {
let $tweet = (sel) => jQuery(sel, tweet);
$tweet('.js-actionFavorite:visible').click();
console.log(
"Unfavourited:\n",
$tweet('.tweet-text').text(),
"\nby ", $tweet('.username').text(), '[ ', $tweet('.js-permalink').text(), ' ]'
);
}
let tweets = document.querySelectorAll('#stream-items-id > li');
let step = 0;
for(let tweet of Array.from(tweets).reverse()) {
setTimeout(unfavourite.bind(null, tweet), step++ * 500 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment