-
-
Save lyuehh/8537324 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
a = _.reduce($("tr"), function(memo, v, i) { | |
var $el = $(v); | |
var obj = {}; | |
obj.id = $.trim($el.find('.end').text()); | |
obj.date = $el.find('td').eq(1).text(); | |
obj.red = $el.find('.STYLE13').html() && $el.find('.STYLE13').html().replace(/ /g, ' '); | |
obj.blue = $el.find('.STYLE12').text(); | |
if (obj.id !== '') { | |
memo.push(obj); | |
} | |
return memo; | |
}, []); | |
console.log(JSON.stringify(a, null, 2)); |
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
#!/bin/sh | |
for i in `seq 2003 2014` | |
do | |
echo $i | |
cat ${i}.html | hquery -p -f a.js | sed '$d' > json/${i}.json | |
done |
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
#!/bin/sh | |
for i in `seq 2003 2014` | |
do | |
u="http://www.3dcp.cn/zs/gonggao.php?type=ssq&year=$i" | |
echo $u | |
curl -s $u | iconv -f gbk -t utf8 | hquery -p -r '$("table").eq(13).parent().html()' > $i.html | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment