Skip to content

Instantly share code, notes, and snippets.

@45deg
Last active August 4, 2019 23:05
Show Gist options
  • Save 45deg/9d23d5bdd0101d27fe0b64ece881d828 to your computer and use it in GitHub Desktop.
Save 45deg/9d23d5bdd0101d27fe0b64ece881d828 to your computer and use it in GitHub Desktop.
Delete All Twitter Likes
// prerequisite: npm install twitter fs-extra delay
const Twitter = require('twitter');
const fs = require('fs-extra');
const delay = require('delay');
var client = new Twitter({
consumer_key: 'WRITE',
consumer_secret: 'YOUR',
access_token_key: 'APP',
access_token_secret: 'KEYS'
});
async function doProc(){
var res = await client.get('favorites/list', { count: 200 });
await fs.outputJson(`db/${Date.now()}.json`, res);
if(res.length === 0) {
throw 'There is no tweets!';
}
for(let ent of res) {
console.log(`@${ent.user.screen_name}: ${ent.text}`);
await client.post('favorites/destroy', { id: ent.id_str });
}
}
(async function(){
try {
while(1){
await doProc();
console.log('😪');
await delay(1000 * 60);
}
} catch(e) {
console.error(e);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment