Skip to content

Instantly share code, notes, and snippets.

@azimicat
Last active November 16, 2021 01:16
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 azimicat/d4f1517cacc9285a6df74b9440dd1b38 to your computer and use it in GitHub Desktop.
Save azimicat/d4f1517cacc9285a6df74b9440dd1b38 to your computer and use it in GitHub Desktop.
(改定済) hontoサイトのcouponページでgetしていないクーポンを一括でgetするスクリプト
// hontoサイトのcouponページ(https://honto.jp/my/account/coupon.html)でgetしていないクーポンを一括でgetするスクリプト
console.log("開始!");
(async function () {
const wait = (seccond) => new Promise(resolve => setTimeout(resolve, seccond));
for await (elem of Array.from(document.querySelectorAll('.coupon-get-button'))) {
console.log(elem);
elem.click();
console.log("Get!");
await wait(500);
}
console.log("completed !!");
window.alert("クーポンを全て取得しました");
})();
@azimicat
Copy link
Author

azimicat commented Jun 7, 2020

querySelectorAll(".coupon-get-button")
これに変更すればいけそうなきがする。

@azimicat
Copy link
Author

azimicat commented Jun 7, 2020

console.log("開始!");
(async function () {
const wait = (seccond) => new Promise(resolve => setTimeout(resolve, seccond));
for await (elem of Array.from(document.querySelectorAll('.coupon-get-button'))) {
console.log(elem);
elem.click();
console.log("Get!");
await wait(500);
}
console.log("completed !!");
window.alert("クーポンを全て取得しました");
})();

@azimicat
Copy link
Author

複数件取得を確認した

@azimicat
Copy link
Author

ブックマーク登録するとこう

javascript:console.log("開始!"),async function(){const o=o=>new Promise(e=>setTimeout(e,o));for await(elem of Array.from(document.querySelectorAll(".coupon-get-button")))console.log(elem),elem.click(),console.log("Get!"),await o(500);console.log("completed !!"),window.alert("クーポンを全て取得しました")}();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment