Skip to content

Instantly share code, notes, and snippets.

@sweshelo
Created March 9, 2023 09:45
Show Gist options
  • Save sweshelo/11e8c265d69163d269127b597d3b8742 to your computer and use it in GitHub Desktop.
Save sweshelo/11e8c265d69163d269127b597d3b8742 to your computer and use it in GitHub Desktop.
KONAMIのゲーム稼働状況をCSVにする
var gameKey = 'CCJ' //ここに収集対象のゲームのキー名を入れる
var list = []
Promise.all([...Array(47).keys()]
.map(pref => fetch(`https://p.eagate.573.jp/game/facility/search/p/list.html?gkey=${gameKey}&paselif=false&area=AR-01&pref=JP-${(pref + 1).toString().padStart(2, '0')}&finder=area`)
.then(e => e.text())
.then(e => {
const dom = new DOMParser().parseFromString(e, "text/html")
list.push({id: pref+1, shops: [...dom.querySelectorAll('.cl_shop_bloc')].map((shop) => {
return {
name: shop.dataset.name,
address: shop.dataset.address,
holiday: shop.dataset.holiday,
latitude: shop.dataset.latitude,
longitude: shop.dataset.longitude,
operation: shop.dataset.operationtime,
}})})
})
)).then(()=>{console.log(list.map(pref => pref.shops.map(shop => `${shop.name}, ${shop.address}, ${shop.latitude}, ${shop.longitude}, ${shop.operation}, ${shop.holiday}`).join('\n')).join('\n'))})
@sweshelo
Copy link
Author

sweshelo commented Mar 9, 2023

  • 一度に取得する件数は cookieの facility_dspcount に依存する
  • この値は 10, 30, 50のいずれかである必要があり、これ以外の値を指定すると自動的に10になる模様
  • 従ってIIDXのような1県あたり50店舗以上の県は一部の情報が切り捨てられることに留意

@sweshelo
Copy link
Author

sweshelo commented Mar 9, 2023

  • クエリパラメータ paselif はPASELIのフラグ
  • 常に area=AR-01 となっているがこれは問題ない
  • datasetは他にも情報を含むため全ての情報を確認したい場合はdevtoolで確認すべし

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