Last active
December 16, 2018 11:34
-
-
Save hakatashi/f5f46dac5a8ee879196c2fea78551d78 to your computer and use it in GitHub Desktop.
npx -p download -p xml2js -p iconv-lite node hongo-meshi.js | grep -v 閉店
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
// npx -p download -p xml2js -p iconv-lite node hongo-meshi.js | grep -v 閉店 | |
const download = require('download'); | |
const xml2js = require('xml2js'); | |
const {promisify} = require('util'); | |
const iconv = require('iconv-lite'); | |
// 中央食堂 | |
const center = { | |
lat: 35.71346867291816, | |
lng: 139.76231575012207, | |
}; | |
(async () => { | |
const data = await download('http://m.is2004.net/?cmd=gcmap'); | |
const root = await promisify(xml2js.parseString)(iconv.decode(data, 'euc-jp')); | |
const locations = root.d.m; | |
for (const location of locations) { | |
const dist = Math.sqrt((parseFloat(location.$.lat) - center.lat) ** 2 + (parseFloat(location.$.lng) - center.lng) ** 2); | |
// やよい軒より遠い | |
if (dist > 0.0056) { | |
continue; | |
} | |
console.log(`${location.$.name} ${location.$.comm ? `(${location.$.comm}) ` : ''}http://m.is2004.net/?${location.$.page}`); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment