Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
npx -p download -p xml2js -p iconv-lite node hongo-meshi.js | grep -v 閉店
// 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
You can’t perform that action at this time.