Skip to content

Instantly share code, notes, and snippets.

@heape
Last active October 23, 2019 14:03
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 heape/92e84dd82db2a3f565f5b8384ea3eb13 to your computer and use it in GitHub Desktop.
Save heape/92e84dd82db2a3f565f5b8384ea3eb13 to your computer and use it in GitHub Desktop.
Twitterいいね!回しスクリプト
/*
ブラウザのコンソール入力。 API制限有るので、ほどほどに!
*/
window['resetScript'] = () => {
window['scriptBusy'] = false;
};
window['invokeScript'] = async() => {
const sleep = ms => new Promise((r, j) => setTimeout(r, ms)); // async用 delay関数
if(window['scriptBusy'] !== undefined && window['scriptBusy'])
return 'please reload your browser. ブラウザの再読み込みをしてください。';
window['scriptBusy'] = true;
for(;;) {
if(!window['scriptBusy'])
break;
scrollTo(0, 0x7fffffff); // 一番下までスクロール、第2引数の "0x7fffffff" は無視で。とりあえず大きい値にしておけばいい。
await sleep(1000);
v = document.querySelectorAll('[data-testid="like"]');
for(let i = 0; i < v.length; i++) {
v[i].click();
await sleep(7000); // 7000ms (7秒以上がベスト) いいねを押す間隔、これが早いとAPIが制限されて、いいねができなくなる。
}
await sleep(1500);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment