Created
October 10, 2021 05:23
-
-
Save muro3r/fed64c22fc7eecc4935dde0c14294cef to your computer and use it in GitHub Desktop.
めんどくさい人向けのオカ研
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
const promptMessages = [ | |
'対象のURLを入力してください', | |
'例) https://p.eagate.573.jp/game/2dx/28/room/okaken/select.html?package=3&lottery=0&consume=0', | |
] | |
let targetURL = window.prompt(promptMessages.join('\n')) | |
targetURL = new URL(targetURL) | |
async function main () { | |
const response = await fetch( | |
'https://p.eagate.573.jp/game/2dx/28/room/okaken/exec.html' + | |
targetURL.search, | |
) | |
const url = new URL(response.url) | |
if (url.pathname == '/game/2dx/28/error/error.html') { | |
console.log('全て生成しました!') | |
return true | |
} | |
// decode SJIS | |
const buffer = await response.arrayBuffer() | |
const body = new TextDecoder('sjis').decode(buffer) | |
const html = document.createElement('html') | |
html.innerHTML = body | |
console.log(html.querySelector('.q_name').innerText) | |
} | |
for (i = 0; i < 3; i++) { | |
const result = await main() | |
if (result) break | |
await new Promise(resolve => setTimeout(resolve, 3000)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment