Skip to content

Instantly share code, notes, and snippets.

@muro3r
Created October 10, 2021 05:23
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 muro3r/fed64c22fc7eecc4935dde0c14294cef to your computer and use it in GitHub Desktop.
Save muro3r/fed64c22fc7eecc4935dde0c14294cef to your computer and use it in GitHub Desktop.
めんどくさい人向けのオカ研
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