Last active
October 23, 2019 14:03
-
-
Save heape/92e84dd82db2a3f565f5b8384ea3eb13 to your computer and use it in GitHub Desktop.
Twitterいいね!回しスクリプト
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
/* | |
ブラウザのコンソール入力。 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