Created
February 24, 2015 13:53
-
-
Save skahack/9f5ea5e32876aecfbcbb to your computer and use it in GitHub Desktop.
ごみ
This file contains 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 fs = require('fs'); | |
var format = require('json-nice'); | |
var xray = require('x-ray'); | |
var src = 'http://www.city.kawasaki.jp/kurashi/category/24-1-11-3-5-0-0-0-0-0.html'; | |
xray(src) | |
.select([{ | |
$root: '.mol_tableblock', | |
"title": "table[summary]", | |
list: [{ | |
$root: 'tr', | |
"町名": "td:nth-child(2)", | |
"普通ごみ": "td:nth-child(3)", | |
"資源ごみ": "td:nth-child(4)", | |
"ミックスペーパー": "td:nth-child(5)", | |
"プラスチック": "td:nth-child(6)", | |
"粗大ごみ": "td:nth-child(7)", | |
"小物金属": "td:nth-child(7)" | |
}] | |
}]) | |
.run(function(err, res){ | |
fs.writeFileSync('takatsu.json', format(res[1])); | |
}); |
This file contains 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 fs = require('fs'); | |
var format = require('json-nice'); | |
var xray = require('x-ray'); | |
var src = 'http://www.city.kawasaki.jp/kurashi/category/24-1-11-3-5-0-0-0-0-0.html'; | |
xray(src) | |
.select([{ | |
$root: '.mol_tableblock', | |
"title": "table[summary]", | |
list: [{ | |
$root: 'tr', | |
"町名": "td:nth-child(2)", | |
"普通ごみ": "td:nth-child(3)", | |
"資源ごみ": "td:nth-child(4)", | |
"ミックスペーパー": "td:nth-child(5)", | |
"プラスチック": "td:nth-child(6)", | |
"粗大ごみ": "td:nth-child(7)", | |
"小物金属": "td:nth-child(7)" | |
}] | |
}]) | |
.run(function(err, res){ | |
fs.writeFileSync('takatsu.json', format(res[0])); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment