├── .gitignore ├── LICENSE ├── README.md ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 alfred sang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # githubrank 2 | 3 | a simple user crawler for githubrank.com 4 | 5 | ## Install 6 | 7 | ``` 8 | $ [sudo] npm i -g githubrank 9 | ``` 10 | 11 | ## Usages 12 | 13 | ``` 14 | $ githubrank justjavac 15 | 17 16 | 17 | justjavac 18 | 迷渡 19 | Tianjin, China 20 | JavaScript 21 | 35 22 | 4313 23 | 2010-08-10 24 | ``` -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var argv = process.argv; 4 | argv.shift(); 5 | 6 | var user = argv[1] 7 | 8 | var Crawler = require("crawler"); 9 | var jsdom = require('jsdom'); 10 | 11 | var c = new Crawler({ 12 | jQuery: jsdom, 13 | maxConnections : 100, 14 | forceUTF8:true, 15 | // incomingEncoding: 'gb2312', 16 | // This will be called for each crawled page 17 | callback : function (error, result, $) { 18 | var td = $("a[href='https://github.com/" + user + "']").closest('tr').find('td') 19 | for(var i = 0; i< td.length; i++) { 20 | var item = $(td).eq(i).text(); 21 | console.log(item) 22 | } 23 | 24 | process.exit() 25 | } 26 | }); 27 | 28 | c.queue('http://githubrank.com/'); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "githubrank", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "preferGlobal": "true", 10 | "bin": { 11 | "githubrank": "index.js" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/i5ting/githubrank.git" 16 | }, 17 | "keywords": [], 18 | "author": "", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/i5ting/githubrank/issues" 22 | }, 23 | "homepage": "https://github.com/i5ting/githubrank#readme", 24 | "dependencies": { 25 | "crawler": "^0.4.3", 26 | "jsdom": "^9.4.1" 27 | } 28 | } 29 | --------------------------------------------------------------------------------