Skip to content

Instantly share code, notes, and snippets.

@skahack
Created February 24, 2015 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skahack/9f5ea5e32876aecfbcbb to your computer and use it in GitHub Desktop.
Save skahack/9f5ea5e32876aecfbcbb to your computer and use it in GitHub Desktop.
ごみ
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]));
});
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