Created
March 9, 2023 09:45
-
-
Save sweshelo/11e8c265d69163d269127b597d3b8742 to your computer and use it in GitHub Desktop.
KONAMIのゲーム稼働状況をCSVにする
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
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'))}) |
- クエリパラメータ
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
facility_dspcount
に依存する