Permalink
Browse files

Okuparser

  • Loading branch information...
maneulyori
maneulyori committed Jan 23, 2013
1 parent c5376fc commit 74af477d8f02d25e5339189dca06af81a897134d
Showing with 74 additions and 9 deletions.
  1. +26 −9 main.js
  2. +48 −0 npm-debug.log
View
35 main.js
@@ -6,26 +6,43 @@ var iconv_euckr_unicode = new iconv("EUC-KR", "UTF-8//TRANSLIT//IGNORE");
var board_oku_url = url.parse("http://oku.korea.ac.kr/admissions/bbs/bbsList.oku?bbs_type=m6.m1.m1");
var board_main_url_ht = new Object();
-var boardList = {"E", "NG", "R", "J"}
+var boardList = ["E", "NG", "R", "J"];
for (var i in boardList)
{
board_main_url_ht[boardList[i]] = url.parse("http://www.korea.ac.kr/do/Main/NoticeList.do?type="+boardList[i]);
}
-function getOku(callback)
+function fetchData(boardUrl, callback)
{
- http.get(board_oku_url, function (res) {
- res.on("data", function (data) {
- var buf = iconv_euckr_unicode.convert(data);
- var str = buf.toString();
+ http.get(boardUrl, function (res) {
+ var isFinished = false;
+ var contentArr = new Array();
+
+ res.on("end", function() {
+ var size = 0;
+
+ var buf = Buffer.concat(contentArr);
+
+ var unibuf = iconv_euckr_unicode.convert(buf);
+
+ callback(unibuf.toString());
+ });
- callback(str);
+ res.on("data", function (data) {
+ contentArr.push(data);
});
});
}
-function parseOku(callback)
+function parseOku(str, callback)
{
- //TODO: add parsing routine.
+ var result = str.match(/^\t(.*)facebook(.*)style(.*)<\/a>$/gm);
+
+ for(var i=0; i<result.length; i++)
+ {
+ console.log(result[i]);
+ }
}
+
+fetchData(board_oku_url, function(str) {parseOku(str, parseOku);});
View
@@ -0,0 +1,48 @@
+0 info it worked if it ends with ok
+1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'buffer' ]
+2 info using npm@1.2.0
+3 info using node@v0.8.17
+4 verbose read json /home/maneulyori/package.json
+5 verbose read json /home/maneulyori/node_modules/sqlite3/package.json
+6 verbose read json /home/maneulyori/node_modules/sandbox/package.json
+7 verbose read json /home/maneulyori/node_modules/bufferjs/package.json
+8 verbose read json /home/maneulyori/node_modules/jsdom/package.json
+9 verbose read json /home/maneulyori/node_modules/node-inspector/package.json
+10 verbose read json /home/maneulyori/node_modules/iconv/package.json
+11 verbose read json /home/maneulyori/package.json
+12 verbose cache add [ 'buffer', null ]
+13 silly cache add name=undefined spec="buffer" args=["buffer",null]
+14 verbose parsed url { pathname: 'buffer', path: 'buffer', href: 'buffer' }
+15 silly lockFile e53c2ea1-buffer buffer
+16 verbose lock buffer /home/maneulyori/.npm/e53c2ea1-buffer.lock
+17 silly lockFile e53c2ea1-buffer buffer
+18 verbose addNamed [ 'buffer', '' ]
+19 verbose addNamed [ null, '' ]
+20 silly lockFile 777de10c-buffer buffer@
+21 verbose lock buffer@ /home/maneulyori/.npm/777de10c-buffer.lock
+22 silly addNameRange { name: 'buffer', range: '', hasData: false }
+23 verbose url raw buffer
+24 verbose url resolving [ 'https://registry.npmjs.org/', './buffer' ]
+25 verbose url resolved https://registry.npmjs.org/buffer
+26 info trying registry request attempt 1 at 13:21:35
+27 http GET https://registry.npmjs.org/buffer
+28 http 404 https://registry.npmjs.org/buffer
+29 silly registry.get cb [ 404,
+29 silly registry.get { server: 'CouchDB/1.2.1 (Erlang OTP/R15B)',
+29 silly registry.get date: 'Wed, 23 Jan 2013 04:20:02 GMT',
+29 silly registry.get 'content-type': 'application/json',
+29 silly registry.get 'content-length': '52',
+29 silly registry.get 'cache-control': 'must-revalidate' } ]
+30 silly lockFile 777de10c-buffer buffer@
+31 error 404 'buffer' is not in the npm registry.
+31 error 404 You should bug the author to publish it
+31 error 404
+31 error 404 Note that you can also install from a
+31 error 404 tarball, folder, or http url, or git url.
+32 error System Linux 3.7.2-201.fc18.x86_64
+33 error command "/usr/bin/node" "/usr/bin/npm" "install" "buffer"
+34 error cwd /home/maneulyori/koreaunivrss
+35 error node -v v0.8.17
+36 error npm -v 1.2.0
+37 error code E404
+38 verbose exit [ 1, true ]

0 comments on commit 74af477

Please sign in to comment.