github Top100
Posted levyleo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了github Top100相关的知识,希望对你有一定的参考价值。
nodejs 文件
var restify = require(‘restify‘), moment = require(‘moment‘), fs = require(‘fs‘), yesterday = moment().hour(-24).format(‘YYYY-MM-DD‘).toString(); function search(object) { if (object.q) { var client = restify.createJsonClient({ url: ‘https://api.github.com‘, }); var path = ‘/search/repositories?q=‘ + object.q; if (object.sort) path = path + ‘&sort=‘ + object.sort; if (object.order) path = path + ‘&order=‘ + object.order; if (object.per_page) path = path + ‘&per_page=‘ + object.per_page; if (object.page) path = path + ‘&page=‘ + object.page; client.get(path, function(err, req_, res_, obj) { if (err) { console.log(err); } else { var items = obj.items; var content = "语言|star|项目名称|描述\n---|---|---|---\n"; for (var i = 0; i < items.length; i++) { var text = (items[i].language || " ") + "|" + (items[i].stargazers_count || " ") + "|[" + (items[i].full_name || " ") + "](" + items[i].html_url + ")|" + (items[i].description || " ") + "\n"; content = content + text; } fs.writeFile(‘./Top100/Top100_‘ + yesterday + ‘.md‘, content, function(err) { if (err) throw err; console.log(‘It\‘s saved!‘); }); } }); } } var object = { q: ‘created:‘ + yesterday, sort: ‘stars‘, order: ‘desc‘, per_page: ‘100‘, page: ‘1‘ }; search(object);
g.sh 文件
#!/bin/bash node github.js cd Top100/ git add ./ git pull git commit -am "update" git push origin master
以上是关于github Top100的主要内容,如果未能解决你的问题,请参考以下文章
GitHub Android Libraries Top 100 简介
iOS开发必读-GitHub 上Top100 的 Objective-C 项目
排名Top 100的Java类库——在分析了47,251个依赖之后得出的结论