-
-
Save ITJesse/630d8d20e67e62c8e1c2b956b996cea1 to your computer and use it in GitHub Desktop.
批量使用漫读券
This file contains hidden or 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
(async () => { | |
let u = new URL(location.href); | |
let mc = u.pathname.match(/detail\/mc(\d+)/); | |
if (mc.length != 2) { | |
return | |
} | |
let mcid = mc[1]; | |
let r = await fetch("https://manga.bilibili.com/twirp/comic.v1.Comic/ComicDetail?device=pc&platform=web", { | |
"headers": { | |
"content-type": "application/json;charset=UTF-8", | |
}, | |
"referrer": "https://manga.bilibili.com/detail/mc" + mcid, | |
"body": JSON.stringify({ "comic_id": mcid }), | |
"method": "POST", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
let data = await r.json(); | |
console.log(mcid, data); | |
if (data.code != 0) { | |
console.warn(data.msg); | |
return | |
} | |
data.data.ep_list.reverse() | |
console.log(data.data.ep_list) | |
let count = 0 | |
for (const v of data.data.ep_list) { | |
if (!v.is_locked) { | |
continue | |
} | |
let r = await fetch("https://manga.bilibili.com/twirp/comic.v1.Comic/BuyEpisode?device=pc&platform=web", { | |
"headers": { | |
"content-type": "application/json;charset=UTF-8", | |
}, | |
"referrer": `https://manga.bilibili.com/mc${mcid}/${v.id}?from=manga_detail`, | |
"referrerPolicy": "strict-origin-when-cross-origin", | |
"body": JSON.stringify({"buy_method":2,"ep_id":v.id,"coupon_id":8900850,"auto_pay_gold_status":2}), | |
"method": "POST", | |
}); | |
let data = await r.json(); | |
console.log(v.ord, v.short_title, data) | |
if (data.code != 0) { | |
console.warn(data.msg); | |
return | |
} | |
count += 1 | |
if (count >= 39) return | |
await new Promise(resolve => setTimeout(resolve, 500)); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment