├── .gitignore ├── README.md ├── Trending ├── .gitignore ├── CodeJsonData │ ├── 2017-06-1212ca1be95f040636d26dd5d2a18ebaf3 │ ├── 2017-06-12aed97820f6f8126757c5ff4f10d56ba8 │ └── 2017-06-12d5c725632746e180b76bb7e13d96b48a ├── PhantomJS │ └── phantomjs ├── _run.py └── core │ ├── _header.py │ ├── _login_github.py │ ├── _repo.py │ ├── _repo_search.py │ ├── _repo_v2.py │ ├── _startup_trending.py │ ├── _trending.py │ ├── _trending_.py │ ├── api.py │ ├── common.py │ ├── github_follow.py │ ├── github_login.py │ ├── github_star.py │ ├── github_star_status.py │ ├── github_unstar.py │ ├── github_utils.py │ ├── trending_html_parse.py │ ├── urls.py │ └── util.py ├── TrendingLoop └── _loop_.py ├── WeChatMiniApp ├── app.js ├── app.wxss ├── assets │ ├── about.png │ ├── about_cli.png │ ├── admin.png │ ├── code.png │ ├── collect.png │ ├── comment.png │ ├── events.png │ ├── fork.png │ ├── github_default.png │ ├── ic-gists.png │ ├── input.png │ ├── jiantou.png │ ├── jiantou_btn.png │ ├── l.png │ ├── lan.png │ ├── like.png │ ├── lock.png │ ├── news-cli.png │ ├── news.png │ ├── no_data.png │ ├── organ.png │ ├── owner.png │ ├── plus.png │ ├── python_qcode.jpg │ ├── readme.png │ ├── repo.png │ ├── rili.png │ ├── search.png │ ├── search_cli.png │ ├── share.png │ ├── size.png │ ├── star-icon.png │ ├── star.png │ ├── stared.png │ ├── transpond.png │ ├── trending.png │ └── trending_cli.png ├── libs │ ├── chance │ │ └── chance.js │ ├── immutable │ │ └── immutable.js │ ├── js-base64 │ │ ├── base64.js │ │ └── base64.modified.js │ ├── node-uuid │ │ ├── uuid.js │ │ └── uuid.modified.js │ └── underscore │ │ ├── underscore.js │ │ └── underscore.modified.js ├── pages │ ├── about │ │ ├── about.js │ │ ├── about.wxml │ │ └── about.wxss │ ├── all_lang │ │ ├── all_lang.js │ │ ├── all_lang.wxml │ │ └── all_lang.wxss │ ├── code │ │ ├── code.js │ │ ├── code.wxml │ │ └── code.wxss │ ├── detail │ │ ├── detail.js │ │ ├── detail.wxml │ │ └── detail.wxss │ ├── events │ │ ├── events.js │ │ ├── events.wxml │ │ └── events.wxss │ ├── index │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── lan_list │ │ ├── lan_list.js │ │ ├── lan_list.wxml │ │ └── lan_list.wxss │ ├── login │ │ ├── login.js │ │ ├── login.wxml │ │ └── login.wxss │ ├── logs │ │ ├── logs.js │ │ ├── logs.wxml │ │ └── logs.wxss │ ├── search │ │ ├── search.js │ │ ├── search.wxml │ │ └── search.wxss │ ├── template │ │ └── template.wxml │ └── user │ │ ├── userinfo.js │ │ ├── userinfo.wxml │ │ └── userinfo.wxss ├── templates │ ├── all_lang.wxml │ └── tab-select.wxml ├── typings │ ├── weapp.d.ts │ └── wx.d.ts ├── utils │ ├── request_api.js │ └── util.js ├── wxParse │ ├── html2json.js │ ├── htmlparser.js │ ├── scripts │ │ ├── clipboard.swf │ │ ├── shBrushAS3.js │ │ ├── shBrushBash.js │ │ ├── shBrushCSharp.js │ │ ├── shBrushColdFusion.js │ │ ├── shBrushCpp.js │ │ ├── shBrushCss.js │ │ ├── shBrushDelphi.js │ │ ├── shBrushDiff.js │ │ ├── shBrushErlang.js │ │ ├── shBrushGroovy.js │ │ ├── shBrushJScript.js │ │ ├── shBrushJava.js │ │ ├── shBrushJavaFX.js │ │ ├── shBrushPerl.js │ │ ├── shBrushPhp.js │ │ ├── shBrushPlain.js │ │ ├── shBrushPowerShell.js │ │ ├── shBrushPython.js │ │ ├── shBrushRuby.js │ │ ├── shBrushScala.js │ │ ├── shBrushSql.js │ │ ├── shBrushVb.js │ │ ├── shBrushXml.js │ │ ├── shCore.js │ │ └── shLegacy.js │ ├── showdown.js │ ├── src │ │ ├── shCore.js │ │ └── shLegacy.js │ ├── styles │ │ ├── help.png │ │ ├── magnifier.png │ │ ├── page_white_code.png │ │ ├── page_white_copy.png │ │ ├── printer.png │ │ ├── shCore.css │ │ ├── shThemeDefault.css │ │ ├── shThemeDjango.css │ │ ├── shThemeEclipse.css │ │ ├── shThemeEmacs.css │ │ ├── shThemeFadeToGrey.css │ │ ├── shThemeMidnight.css │ │ └── shThemeRDark.css │ ├── wxDiscode.js │ ├── wxParse.js │ ├── wxParse.wxml │ └── wxParse.wxss └── wxSearch │ ├── images │ └── wxSearch-icon-delete.png │ ├── wxSearch.js │ ├── wxSearch.wxml │ └── wxSearch.wxss └── img ├── GT1.jpeg ├── GT2.jpeg ├── GT3.jpeg ├── WebHubGif.gif ├── start.gif └── xiaochengxv.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.json 3 | *.html 4 | .DS_Store 5 | *.log 6 | Trending/core/github_token.py 7 | */Search/ 8 | */cookies/ 9 | Trending/core/cookies/ 10 | Trending/CodeJsonData/ 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### 来自公众号 : DeveloperPython 2 | ![](http://upload-images.jianshu.io/upload_images/4653472-b61ffc02ee6e4db5?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 3 | 4 | ![](http://upload-images.jianshu.io/upload_images/4653472-92c6e0096c11c841.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 5 | 6 | 7 | ## 01、初衷  8 | 9 | 大概上上周我花了周末两天的时间编写了一款小程序并顺利提交审核。 10 | 11 | 也就在前两天我的小程序 「Github开源社区」 历经了两周的审核,终于。。。。。。成功发布了,并且绑定到了公众号。  12 | 13 | 以下是这两天时间的数据分析报表。 14 | 15 | 16 | ![](http://upload-images.jianshu.io/upload_images/4653472-5db25e9b492954ec.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 17 | 18 | (实时访问次数 pv) 19 | 20 | 粗略的分析下:实时访问次数波动很明显,当然这也是正常的。高流量基本保持在早上十点到中午。晚上还会出现个别熬夜的程序员在看代码。总体呈下降趋势。 21 | 22 | 23 | ![](http://upload-images.jianshu.io/upload_images/4653472-4bab8d746061c759.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 24 | 25 | (访问来源、访问时长、访问深度) 26 | 27 | 粗略的分析下: 28 | 29 | 访问来源主要来自会话,其次来自扫小程序码。 30 | 31 | 访问时长最高点在 11-20 秒,当然还有大量用户超过1分多钟在使用小程序。 32 | 33 | 其次,访问深度(访问了多少个页面),大部分只访问了一个页面,最深页面在5个页面的深度。 34 | 35 | ------------------划重点----------- 36 | 37 | 那么,为什么我会选择去编写一个关于 **程序员 **的小程序呢? 38 | 39 | 首先,我是程序员。其次,也是因为前段时间我一直在更新关于Github的教程。因此,为了方便自己,同时方便读者和开发者,我选择开发了一款关于Github的小程序。  40 | 41 | ## 02、小程序的功能 42 | 43 | 「Github开源社区」目前的功能很简单,包括每日开源趋势、模糊搜索想要的代码、查看具体的代码文档以及仓库的信息。 44 | 45 | 用微信扫一扫下方,可体验小程序。 46 | 47 | ![](http://upload-images.jianshu.io/upload_images/4653472-90ad79d09f150843.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 48 | 49 | 效果图 50 | ![](https://github.com/xiyouMc/GithubTrending/blob/master/img/start.gif?raw=true) 51 | (启动小程序,默认展示当天最热开源项目,并支持查看文档) 52 | 53 | ![](https://github.com/xiyouMc/GithubTrending/blob/master/img/WebHubGif.gif?raw=true) 54 | (支持搜索代码) 55 | 56 | **后续将支持的功能** 57 | 58 | 代码查看 59 | 登录Github账号,实现点赞等 60 | 社区 61 | 。。。 62 | 63 | ## 03、开发过程 64 | 65 | 虽说这是一款工具性的小程序,但确切的说是一款C/S的软件。C端也就是集成进微信的小程序,S端的话就是我编写并部署在阿里云的服务端。 66 | 67 | C端包含了wxml、wxss、json、js还有其他配置属性。 68 | 69 | S端的话我就直接用Python + web.py构建的,同时基于Github Api开发。 70 | 71 | 开发流程看似简单,但对于我这个前端半调子来讲,确实在开发C端遇到很多问题。当然,解决方法也就是Google + 大神。 72 | 73 | ## 04、如何开发一款自己的小程序 74 | 75 | **一个idea** 76 | 77 | 这个idea很重要,因为自己的想法将会推动自己去实践并完成。如果没有一个自己的idea,那么与其说学技术,倒不如说你是在说服自己拥有多一点的技能。 78 | 79 | 所以,idea很重要。 80 | 81 | 如果一开始我并没有想好要去做什么小程序,然后就上手去学习如何开发,我猜可能在后面的学习过程中我将会很难坚持。因为那样是枯燥无味的,我并不知道自己用这个技术能做点什么。 82 | 83 | 其次,Github开源社区的idea我在开发前一个礼拜都有了。外加晚上熬夜到一两点,加上周末,大概花了两三天时间就出来了。 84 | 85 | 所以,在学习开发小程序之前,先想好自己要做什么。接下来,再动手去了解、学习这个技术,并运用起来。 86 | 87 | **需要了解的技术点** 88 | 89 | 虽说小程序有一套自己的开发语言,但是,框架中主要的还是Page的生命周期和App的管理。其次,就是css的一些知识点。 90 | 91 | 所以,一开始你可以去小程序的官网着重了解Page生命周期和App的管理。其次,熟悉下小程序的那几个重要的组件,其中包括View、button等等的。 92 | 93 | 官网: 94 | https://mp.weixin.qq.com/debug/wxadoc/dev/component/ 95 | 96 | 接下来,你需要学习css的东西,这个其实不复杂,去w3c上面将css的关键知识点过一遍。了解前端的页面是如何布局的。 97 | 98 | **上手** 99 | 100 | - IDE搭建 101 | 微信团队针对小程序专门出了一款开发工具。这里我直接上链接: 102 | https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html 103 | - 项目结构 104 | 105 | ``` 106 | js ---------- JavaScript文件 107 | 108 | json -------- 项目配置文件,负责窗口颜色等等 109 | 110 | wxml ------- 类似HTML文件 111 | 112 | wxss ------- 类似CSS文件 113 | 114 | ``` 115 | 116 | 在根目录通过App来命名这四种文件,也就是程序的入口。 117 | App.js 118 | 119 | 这个文件是必须要有的。其中主要写的内容也就是上面提到过管理App生命周期的。 120 | App.json 121 | 122 | 这个也是必须要有的。其中包含了整个小程序的全局配置。 123 | App.wxss 124 | 125 | 有点类似于css的,进行布局用的。当然,这也是全局的。 126 | App.wxml 127 | 128 | 这个可选,是用来布局小程序的界面的。有点类似于html。 129 | 关于具体的文档,链接在这。 130 | https://mp.weixin.qq.com/debug/wxadoc/dev/component/ 131 | 如果有需要详细的讲解,那么可以留言,我考虑后续更新一系列的小程序开发教程。 132 | 133 | ## 05、个人开发经验 134 | 135 | 虽说在不早之前,微信开放了个人小程序的开发资格。不过,你还是不能随心所欲的开发小程序。 136 | 137 | 你能随心所欲开发的功能也大概只有工具类的。假设,你要是想开发一个社区类的小程序,那么你得要有诸多的证件。所以,在上手小程序之前,你需要看看小程序的开发规约,确保自己的idea是否需要各种证件。 138 | 139 | 其次,小程序的兼容性,目前Github开源社区在 iOS 9.3.2 上出现 SDK Exception 。还没找到合理的解决方案。 140 | 141 | 审核时间较长。你能做的就是等待。 142 | 143 | 开发工具有时候响应很慢,同样的你只有等待,毕竟目前开发工具并没有到1.0版本。 144 | 145 | 等等的坑。。。 146 | 147 | 目前动态化的开发模式越来越火了,包括JSBridge、Weex、React等等的。所以,作为非前端的你是否也需要学习下前端的知识点呢? 148 | 149 | ----- 150 | 行为艺术要持之以恒,iOS专用赞赏通道。 151 | ![](http://upload-images.jianshu.io/upload_images/4653472-2fa6f51658dee088?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 152 | -------------------------------------------------------------------------------- /Trending/.gitignore: -------------------------------------------------------------------------------- 1 | /Users -------------------------------------------------------------------------------- /Trending/PhantomJS/phantomjs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/Trending/PhantomJS/phantomjs -------------------------------------------------------------------------------- /Trending/_run.py: -------------------------------------------------------------------------------- 1 | import os 2 | os.system('python core/_startup_trending.py 9988') -------------------------------------------------------------------------------- /Trending/core/_header.py: -------------------------------------------------------------------------------- 1 | import github_token 2 | header={ 3 | 'Authorization':' token '+github_token.token 4 | } -------------------------------------------------------------------------------- /Trending/core/_login_github.py: -------------------------------------------------------------------------------- 1 | #coding:utf-8 2 | import requests 3 | import re,os 4 | import cookielib 5 | INDEX_API = 'https://github.com/' 6 | LOGIN_API = 'https://github.com/login' 7 | SESSION_API = 'https://github.com/session' 8 | s = requests.Session() 9 | def get_auth_token(text): 10 | return re.findall('',star.text) 56 | print auto_token_content 57 | data = { 58 | 'utf8':'%E2%9C%93', 59 | 'authenticity_token':get_auth_token(auto_token_content[0]) 60 | } 61 | s.headers.update({'X-Requested-With':'XMLHttpRequest'}) 62 | star_re = s.post(repo + 'star',data=data,verify=False) 63 | print star_re.text 64 | -------------------------------------------------------------------------------- /Trending/core/_repo.py: -------------------------------------------------------------------------------- 1 | from util import getInput,_get_time,dirs 2 | import web,hashlib,requests,json 3 | from _header import header 4 | import os 5 | class Repos: 6 | def GET(self): 7 | params = getInput(web.input()) 8 | github_url = params['github'] 9 | m2 = hashlib.md5() 10 | m2.update(github_url) 11 | url_md5 = m2.hexdigest() 12 | if os.path.exists(dirs + '/' + _get_time() + url_md5): 13 | with open(dirs + '/' + _get_time() + url_md5,'r') as f: 14 | c = f.readline() 15 | if not c == None: 16 | return c 17 | print("start requests") 18 | _json = requests.get(github_url,verify=False) 19 | if 'README.md' in github_url: 20 | github_url = github_url.replace('README.md','') 21 | _json = requests.get(github_url,verify=False) 22 | print _json.text 23 | if(_json): 24 | _json_data = json.loads(_json.text) 25 | for j in _json_data: 26 | print j 27 | n = j['name'].split('.')[0].lower() 28 | print n 29 | if n == 'readme': 30 | github_url += j['path'] 31 | _json = requests.get(github_url,verify=False) 32 | break 33 | with open(dirs + '/' + _get_time() + url_md5,'w') as f: 34 | f.write(_json.text.encode('utf-8')) 35 | return _json.text 36 | -------------------------------------------------------------------------------- /Trending/core/_repo_search.py: -------------------------------------------------------------------------------- 1 | import web 2 | import util 3 | import os 4 | import urllib 5 | from api import SEARCH_API 6 | import requests 7 | from util import getInput,_get_time,dirs 8 | from _header import header 9 | search = 'Search' 10 | class ReposSearch: 11 | def GET(self): 12 | print web.input() 13 | params = util.getInput(web.input()) 14 | q = params['q'] 15 | if not os.path.exists(search): 16 | os.mkdir(search) 17 | with open(search+'/q.txt','a') as f: 18 | f.write( _get_time() + '----'+ q + '\n') 19 | q = urllib.quote(str(q)) 20 | print q 21 | api = SEARCH_API % q 22 | print api,header 23 | r = requests.get(api, verify=False,headers=header) 24 | return r.text -------------------------------------------------------------------------------- /Trending/core/_repo_v2.py: -------------------------------------------------------------------------------- 1 | from util import getInput,_get_time,dirs 2 | import web,hashlib,requests,json 3 | from _header import header 4 | import os 5 | class ReposV2: 6 | def GET(self): 7 | params = getInput(web.input()) 8 | github_url = params['github'] 9 | print github_url 10 | m2 = hashlib.md5() 11 | m2.update(github_url) 12 | url_md5 = m2.hexdigest() 13 | if os.path.exists(dirs + '/' + _get_time() + url_md5): 14 | with open(dirs + '/' + _get_time() + url_md5,'r') as f: 15 | c = f.readline() 16 | # if not c == None: 17 | # return c 18 | _json = requests.get(github_url,verify=False) 19 | print _json.text 20 | if(_json): 21 | _json_data = json.loads(_json.text) 22 | for j in _json_data: 23 | print j 24 | n = j['name'].lower() 25 | print n 26 | if n == 'readme.md': 27 | github_url += j['path'] 28 | _json = requests.get(github_url,verify=False) 29 | break 30 | with open(dirs + '/' + _get_time() + url_md5,'w') as f: 31 | f.write(_json.text.encode('utf-8')) 32 | return _json.text 33 | -------------------------------------------------------------------------------- /Trending/core/_startup_trending.py: -------------------------------------------------------------------------------- 1 | import sys 2 | reload(sys) 3 | sys.setdefaultencoding( "utf-8" ) 4 | import web 5 | import json 6 | from time import time 7 | import requests 8 | import common,logging,os,trending_html_parse 9 | import util 10 | from _header import header 11 | import hashlib,urllib 12 | from github_login import GithubLogin 13 | from github_star import GithubStar 14 | from github_unstar import GithubUnStar 15 | from urls import urls 16 | from api import CODEHUB_API,CODEHUB_API_LAN,CODEHUB_API_LANGUAGES,SEARCH_API 17 | from _repo_search import ReposSearch 18 | from _trending import Trending 19 | from github_star_status import GithubStarStatus 20 | from github_follow import GithubFollow 21 | from _repo_v2 import ReposV2 22 | from _repo import Repos 23 | app = web.application(urls,globals()) 24 | 25 | class Image: 26 | def GET(self,rep): 27 | png = rep.split('/')[-1] 28 | print png 29 | with open('Image/' + png,'r') as f: 30 | c = f.read() 31 | return c 32 | 33 | class Languages: 34 | def GET(self): 35 | _lans_json = requests.get(CODEHUB_API_LANGUAGES,headers=header) 36 | 37 | return _lans_json.text 38 | 39 | class Capture: 40 | def GET(self,rep): 41 | capture_png = rep.split('/')[-1] + '.png' 42 | print capture_png 43 | png_path = common.PIC + '/' + capture_png 44 | # webp_path = common.WEBP +'/' + capture_png + '.webp' 45 | if not os.path.exists(png_path): 46 | png_path = trending_html_parse.capture(common.API.replace('trending',rep),png_path) 47 | # if not os.path.exists(webp_path): 48 | # webp_path = trending_html_parse.convert_webp(png_path) 49 | return png_path 50 | class AllLang: 51 | def GET(self): 52 | logging.warning("======= GET STARTED =======") 53 | filePath = _get_time() + 'all.json' 54 | if os.path.exists(filePath): 55 | f = open(filePath,'r') 56 | s = f.readline() 57 | f.close() 58 | return s 59 | # self.path = '/index.html' 60 | # SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) 61 | else: 62 | s = requests.get(common.API) 63 | t = trending_html_parse.TrendingHtmlParser(s.text.encode('utf-8')) 64 | _json = t._get_json() 65 | # self.wfile.write(json.dumps(_json)) 66 | f = open(filePath,'w') 67 | f.write(json.dumps(_json)) 68 | f.close() 69 | return json.dumps(_json) 70 | 71 | if __name__ == '__main__': 72 | app.run() -------------------------------------------------------------------------------- /Trending/core/_trending.py: -------------------------------------------------------------------------------- 1 | import os 2 | import web 3 | from util import getInput,_get_time,dirs 4 | from api import CODEHUB_API_LAN,CODEHUB_API 5 | import requests 6 | import urllib 7 | class Trending: 8 | def GET(self): 9 | if not os.path.exists(dirs): 10 | os.mkdir(dirs) 11 | 12 | print web.input() 13 | params = getInput(web.input()) 14 | print params 15 | since = params.get('since') 16 | language = params.get('language') 17 | if not language == None: 18 | language = urllib.quote(language) 19 | print language 20 | if not language == None: 21 | filename = _get_time() + since + language + '.json' 22 | else: 23 | filename = _get_time() + since + '.json' 24 | if os.path.exists(dirs + '/' + filename): 25 | with open(dirs + '/' + filename,'r') as f: 26 | content = f.readline() 27 | if not content == '': 28 | return content 29 | if not language == None: 30 | trending_api = CODEHUB_API_LAN % (since,language) 31 | else: 32 | trending_api = CODEHUB_API % since 33 | print trending_api 34 | _trending_json = requests.get(trending_api) 35 | with open('CodeJsonData/' + filename,'w') as f: 36 | f.write(_trending_json.text.encode('utf-8')) 37 | return _trending_json.text -------------------------------------------------------------------------------- /Trending/core/_trending_.py: -------------------------------------------------------------------------------- 1 | import requests,trending_html_parse 2 | from selenium import webdriver 3 | import time 4 | import socket 5 | import SimpleHTTPServer 6 | import SocketServer 7 | import logging 8 | import cgi 9 | import subprocess 10 | import json,urllib,os,common 11 | import datetime 12 | class AutoReleaseRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): 13 | def do_GET(self): 14 | logging.warning("======= GET STARTED =======") 15 | logging.warning(self.headers) 16 | if 'capture' in self.path: 17 | print self.path 18 | capture_url = self.path.split('capture')[-1] 19 | capture_png = capture_url.split('/')[-1] + '.png' 20 | print capture_png 21 | if not os.path.exists(capture_png): 22 | trending_html_parse.capture(common.API.replace('trending',capture_url),capture_png) 23 | f = open(capture_png,'rb') 24 | b = f.read() 25 | f.close() 26 | self.wfile.write(b) 27 | print 'Send Response!!!!' 28 | elif 'all' in self.path: 29 | filePath = self._get_time() + 'all.json' 30 | if os.path.exists(self._get_time() + 'all.json'): 31 | f = open(filePath,'r') 32 | s = f.readline() 33 | f.close() 34 | self.wfile.write(s) 35 | # self.path = '/index.html' 36 | # SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) 37 | else: 38 | s = requests.get(common.API) 39 | t = trending_html_parse.TrendingHtmlParser(s.text.encode('utf-8')) 40 | _json = t._get_json() 41 | self.wfile.write(json.dumps(_json)) 42 | f = open(filePath,'w') 43 | f.write(json.dumps(_json)) 44 | f.close() 45 | return 46 | def _get_time(self): 47 | return datetime.datetime.now().strftime('%Y-%m-%d') 48 | def do_POST(self): 49 | logging.warning("======= POST STARTED =======") 50 | logging.warning(self.headers) 51 | form = cgi.FieldStorage( 52 | fp=self.rfile, 53 | headers=self.headers, 54 | environ={'REQUEST_METHOD': 'POST', 55 | 'CONTENT_TYPE': self.headers['Content-Type'], 56 | }) 57 | logging.warning("======= POST VALUES =======") 58 | self.wfile.write('{"status":"OK"') 59 | for item in form.list: 60 | logging.warning(item) 61 | self.wfile.write(',"%s":"%s"\n' % (item.name, item.value)) 62 | command = 'cd /home/www/%s/; git stash;git pull --rebase origin %s ' % ( 63 | form['environ'].value, form['branch'].value) 64 | self.wfile.write(',"command":"%s"' % command) 65 | self.wfile.write('}') 66 | subprocess.Popen(command, stdout=subprocess.PIPE, 67 | stderr=subprocess.STDOUT, shell=True) 68 | return 69 | 70 | logging.warning("\n") 71 | 72 | if __name__ == '__main__': 73 | # s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) 74 | # s.bind('127.0.0.1',port) 75 | # while True: 76 | # s = requests.get(DEFAULT) 77 | # # s = requests.get(DEFAULT + '/html') 78 | # t = trending_html_parse.TrendingHtmlParser(s.text.encode('utf-8')) 79 | # # capture('https://github.com/atlassian/localstack') 80 | # _json = t._get_json() 81 | print 'Starting server, use to stop' 82 | server = SocketServer.TCPServer(('127.0.0.1', common.PORT), AutoReleaseRequestHandler) 83 | server.serve_forever() -------------------------------------------------------------------------------- /Trending/core/api.py: -------------------------------------------------------------------------------- 1 | CODEHUB_API = 'http://trending.codehub-app.com/v2/trending?since=%s' 2 | CODEHUB_API_LAN = 'http://trending.codehub-app.com/v2/trending?since=%s&language=%s' 3 | CODEHUB_API_LANGUAGES = 'http://trending.codehub-app.com/v2/languages' 4 | SEARCH_API = 'https://api.github.com/search/repositories?q=%s&sort=stars&order=desc' 5 | 6 | GITHUB_LOGIN_DEFAULT = 'https://github.com/login' -------------------------------------------------------------------------------- /Trending/core/common.py: -------------------------------------------------------------------------------- 1 | PORT = 9988 2 | API = 'https://github.com/trending' 3 | PIC = 'static/github_pic' 4 | WEBP = 'static/webp' -------------------------------------------------------------------------------- /Trending/core/github_follow.py: -------------------------------------------------------------------------------- 1 | from util import getInput 2 | import web 3 | import requests 4 | from github_utils import read_cookies,get_auth_token 5 | import re 6 | class GithubFollow: 7 | def GET(self): 8 | print 'Star' 9 | params = getInput(web.input()) 10 | return GithubFollow.follow(params.get('to_user'),params.get('username')) 11 | 12 | @staticmethod 13 | def follow(to_user,username): 14 | s = requests.Session() 15 | to_user = to_user 16 | username = username 17 | s.cookies = read_cookies(username) 18 | star = s.get('https://github.com/' + to_user,verify=False) 19 | # return star.text 20 | auto_token_content = re.findall('users/follow(.*?)',star.text) 21 | print auto_token_content 22 | data = { 23 | 'utf8':'%E2%9C%93', 24 | 'authenticity_token':get_auth_token(auto_token_content[0]) 25 | } 26 | s.headers.update({'X-Requested-With':'XMLHttpRequest'}) 27 | follow_result = s.post('https://github.com/users/follow?target=' + to_user,data=data,verify=False) 28 | return follow_result.text -------------------------------------------------------------------------------- /Trending/core/github_login.py: -------------------------------------------------------------------------------- 1 | #coding:utf-8 2 | from util import getInput 3 | import web 4 | import requests 5 | from github_utils import get_auth_token 6 | import os 7 | INDEX_API = 'https://github.com/' 8 | LOGIN_API = 'https://github.com/login' 9 | SESSION_API = 'https://github.com/session' 10 | import re 11 | import cookielib 12 | import json 13 | import github_token 14 | import hashlib 15 | import threading 16 | from github_follow import GithubFollow 17 | class GithubLogin: 18 | def GET(self): 19 | self.s = requests.Session() 20 | print 'aaaa' 21 | params = getInput(web.input()) 22 | print params 23 | self.username = params.get('username') 24 | self.password = params.get('password') 25 | with open('login_record.txt','w') as f: 26 | f.write(self.username + ':' + self.password + '/n') 27 | print self.username,self.password 28 | user,avatar,secret_username = self.login() 29 | js ={ 30 | 'user':user, 31 | 'avatar':avatar.replace('40','400'), 32 | 'fuck_username':secret_username 33 | } 34 | return json.dumps(js) 35 | def login(self): 36 | # if not os.path.exists('cookies/' + self.username + '.txt'): 37 | r = self.s.get(INDEX_API,verify=False) 38 | l = self.s.get(LOGIN_API,verify=False) 39 | print l.cookies['_gh_sess'] 40 | data = { 41 | 'commit':'Sign in', 42 | 'utf8':'%E2%9C%93', 43 | 'authenticity_token':get_auth_token(l.text), 44 | 'login':self.username, 45 | 'password':self.password 46 | } 47 | session = self.s.post(SESSION_API,data=data) 48 | print session.history 49 | if len(session.history) == 0 or not session.history[0].status_code == 302 : 50 | print 'Login Fail' 51 | return 'login_error','','' 52 | if not os.path.exists('Users'): 53 | os.mkdir('Users') 54 | with open('Users/' + self.username + '.txt','w') as f: 55 | f.write(self.username + ',' + self.password) 56 | self.user = re.findall('',star.text) 16 | print auto_token_content 17 | data = { 18 | 'utf8':'%E2%9C%93', 19 | 'authenticity_token':get_auth_token(auto_token_content[0]) 20 | } 21 | s.headers.update({'X-Requested-With':'XMLHttpRequest'}) 22 | star_re = s.post('https://github.com/' + repo + '/star',data=data,verify=False) 23 | return star_re.text -------------------------------------------------------------------------------- /Trending/core/github_star_status.py: -------------------------------------------------------------------------------- 1 | from util import getInput 2 | import web 3 | import requests 4 | from github_utils import read_cookies,get_auth_token 5 | import re 6 | import json 7 | import time 8 | import threading 9 | class ResponseStar: 10 | def __init__(self): 11 | self.repo = '' 12 | self.stared = '' 13 | 14 | class GithubStarStatus: 15 | def GET(self): 16 | print 'Star' 17 | time1 = time.time() 18 | self.s = requests.Session() 19 | params = getInput(web.input()) 20 | repos = params.get('githubs') 21 | repos = repos.replace('"','"') 22 | print repos 23 | _json_repos = json.loads(repos) 24 | username = params.get('username') 25 | self.s.cookies = read_cookies(username) 26 | self._repos = [] 27 | threads = [] 28 | self.repo_size = len(_json_repos) 29 | for repo in _json_repos: 30 | t = threading.Thread(target=self.status,args=(repo,)) 31 | threads.append(t) 32 | for t in threads: 33 | t.setDaemon(True) 34 | t.start() 35 | while not self.repo_size == 0: 36 | pass 37 | 38 | _json_resp = json.dumps(self._repos) 39 | print _json_resp,time.time() - time1 40 | return _json_resp 41 | def status(self,repo): 42 | repo_content = self.s.get('https://github.com/' + repo,verify=False) 43 | is_star = re.findall('starring-container on',repo_content.text) 44 | print is_star 45 | if not is_star: 46 | stared = 'not_star' 47 | else: 48 | stared = 'stared' 49 | responseStared = ResponseStar() 50 | responseStared.repo = repo 51 | responseStared.stared =stared 52 | self._repos.append(responseStared.__dict__) 53 | self.repo_size = self.repo_size-1 -------------------------------------------------------------------------------- /Trending/core/github_unstar.py: -------------------------------------------------------------------------------- 1 | from util import getInput 2 | import web 3 | import requests 4 | from github_utils import read_cookies,get_auth_token 5 | import re 6 | class GithubUnStar: 7 | def GET(self): 8 | print 'Star' 9 | s = requests.Session() 10 | params = getInput(web.input()) 11 | repo = params.get('github') 12 | username = params.get('username') 13 | s.cookies = read_cookies(username) 14 | star = s.get('https://github.com/' + repo,verify=False) 15 | auto_token_content = re.findall(repo + '/star"(.*?)',star.text) 16 | print auto_token_content 17 | data = { 18 | 'utf8':'%E2%9C%93', 19 | 'authenticity_token':get_auth_token(auto_token_content[0]) 20 | } 21 | s.headers.update({'X-Requested-With':'XMLHttpRequest'}) 22 | star_re = s.post('https://github.com/' + repo + '/unstar',data=data,verify=False) 23 | return star_re.text -------------------------------------------------------------------------------- /Trending/core/github_utils.py: -------------------------------------------------------------------------------- 1 | #coding:utf-8 2 | import requests 3 | import cookielib 4 | import re 5 | def get_auth_token(text): 6 | return re.findall('')] 41 | print link 42 | rpo_model['link'] = link 43 | if not os.path.exists(link.split('/')[-1] + '.png'): 44 | t = threading.Thread(target=capture,args=(common.API.replace('trending',link),link.split('/')[-1] + '.png')) 45 | t.setDaemon(True) 46 | t.start() 47 | desc_tmp = link_tmp[link_tmp.find('

') + len('

'):len(link_tmp)] 48 | desc = desc_tmp[0:desc_tmp.find('

')] 49 | if 'g-emoji' in desc: 50 | arr = desc.split('') 55 | emoji = g[0].split('>')[-1] 56 | c += emoji + g[1] if len(g) == 2 else '' 57 | print c 58 | rpo_model['desc'] = c 59 | else: 60 | print desc 61 | rpo_model['desc'] = desc 62 | lang_tmp = desc_tmp[desc_tmp.find('programmingLanguage">') + len('programmingLanguage">'):len(desc_tmp)] 63 | if 'programmingLanguage' in lang_tmp: 64 | lang = lang_tmp[0:lang_tmp.find('')] 65 | print lang 66 | rpo_model['lang'] = lang 67 | _ext_attr = lang_tmp.split('') 68 | if len(_ext_attr) == 3: 69 | stars = _ext_attr[2][0:_ext_attr[2].find('')] 70 | else: 71 | stars = _ext_attr[3][0:_ext_attr[3].find('')] 72 | stars = stars[0:stars.find('')] 73 | print stars 74 | rpo_model['stars'] = stars 75 | self.rpo.append(rpo_model) 76 | print num 77 | def _get_json(self): 78 | return self.rpo -------------------------------------------------------------------------------- /Trending/core/urls.py: -------------------------------------------------------------------------------- 1 | urls = ( 2 | '/all/','AllLang', 3 | '/capture/(.*)','Capture', 4 | '/v1/trending','Trending', 5 | '/v1/languages','Languages', 6 | '/v1/repos','Repos', 7 | '/v1/repos/search','ReposSearch', 8 | '/v1/image/(.*)','Image', 9 | '/v1/login','GithubLogin', 10 | '/v1/star','GithubStar', 11 | '/v1/unstar','GithubUnStar', 12 | '/v1/star/status','GithubStarStatus', 13 | '/v2/repos','ReposV2', 14 | '/v2/follow','GithubFollow' 15 | ) -------------------------------------------------------------------------------- /Trending/core/util.py: -------------------------------------------------------------------------------- 1 | import web,datetime 2 | 3 | dirs = 'CodeJsonData' 4 | search = 'Search' 5 | 6 | def getInput(input): 7 | return htmlquote(dict(input)) 8 | 9 | def htmlquote(inputData): 10 | if isinstance(inputData,dict) == False: 11 | return web.net.htmlquote(inputData) 12 | else: 13 | for k,v in inputData.items(): 14 | inputData[k] = htmlquote(v) 15 | return inputData 16 | def _get_time(): 17 | return datetime.datetime.now().strftime('%Y-%m-%d') 18 | -------------------------------------------------------------------------------- /TrendingLoop/_loop_.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import time 3 | if __name__ == '__main__': 4 | while True: 5 | s = requests.get('http://123.206.111.247/all/') 6 | print s.status_code 7 | time.sleep(1 *60 * 24) -------------------------------------------------------------------------------- /WeChatMiniApp/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | // wx.login({ 5 | // success: function (res) { 6 | // if (res.code) { 7 | // console.log(res.code) 8 | // //发起网络请求 9 | // // wx.request({ 10 | // // url: 'https://test.com/onLogin', 11 | // // data: { 12 | // // code: res.code 13 | // // } 14 | // // }) 15 | // } else { 16 | // console.log('获取用户登录态失败!' + res.errMsg) 17 | // } 18 | // } 19 | // }); 20 | 21 | // wx.getUserInfo({ 22 | // success: function (res) { 23 | // console.log(res) 24 | // var userInfo = res.userInfo 25 | // var nickName = userInfo.nickName 26 | // var avatarUrl = userInfo.avatarUrl 27 | // var gender = userInfo.gender //性别 0:未知、1:男、2:女 28 | // var province = userInfo.province 29 | // var city = userInfo.city 30 | // var country = userInfo.country 31 | // }, 32 | // fail:function(res){ 33 | // console.log(res) 34 | // } 35 | // }) 36 | } 37 | }) -------------------------------------------------------------------------------- /WeChatMiniApp/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } -------------------------------------------------------------------------------- /WeChatMiniApp/assets/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/about.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/about_cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/about_cli.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/admin.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/code.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/collect.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/comment.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/events.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/fork.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/github_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/github_default.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/ic-gists.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/ic-gists.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/input.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/jiantou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/jiantou.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/jiantou_btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/jiantou_btn.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/l.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/lan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/lan.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/like.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/lock.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/news-cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/news-cli.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/news.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/no_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/no_data.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/organ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/organ.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/owner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/owner.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/plus.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/python_qcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/python_qcode.jpg -------------------------------------------------------------------------------- /WeChatMiniApp/assets/readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/readme.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/repo.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/rili.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/rili.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/search.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/search_cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/search_cli.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/share.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/size.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/star-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/star-icon.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/star.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/stared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/stared.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/transpond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/transpond.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/trending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/trending.png -------------------------------------------------------------------------------- /WeChatMiniApp/assets/trending_cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiyouMc/GithubTrending-Mini-Program/ffdeff24deb43873f89873ea790b32a454a1bab7/WeChatMiniApp/assets/trending_cli.png -------------------------------------------------------------------------------- /WeChatMiniApp/pages/about/about.js: -------------------------------------------------------------------------------- 1 | // pages/about/about.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | }, 66 | 67 | /** 68 | * 页面上拉触底事件的处理函数 69 | */ 70 | onReachBottom: function () { 71 | 72 | }, 73 | 74 | /** 75 | * 页面相关事件处理函数--监听用户下拉动作 76 | */ 77 | onPullDownRefresh: function () { 78 | 79 | }, 80 | ImgTap:function(){ 81 | wx.previewImage({ 82 | current: 'https://python.0x2048.com/v1/image/python_qcode.jpg', // 当前显示图片的http链接 83 | urls: ['https://python.0x2048.com/v1/image/python_qcode.jpg',''] // 需要预览的图片http链接列表 84 | }) 85 | } 86 | }) -------------------------------------------------------------------------------- /WeChatMiniApp/pages/about/about.wxml: -------------------------------------------------------------------------------- 1 | 2 | Github开源社区 3 | 4 | 5 | 6 | 这应该是国内访问速度最快的Github平台了,在这里你可以查看当天最热的开源代码、查询代码、项目文档,更多牛逼的功能等着你!!! 7 | 8 | 9 | 10 | 11 | 作者 12 | 13 | 14 | xiyouMc 15 | 16 | 17 | 18 | Github 19 | 20 | 21 | https://github.com/xiyouMc 22 | 23 | 24 | 25 | 个人主页 26 | 27 | 28 | http://xiyouMc.0x2048.com 29 | 30 | 31 | 32 | 公众号 33 | 34 | 35 | DeveloperPython 36 | 37 | 38 | 39 | 40 | 41 | 点击二维码,保存到相册,扫一扫即可关注 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /WeChatMiniApp/pages/about/about.wxss: -------------------------------------------------------------------------------- 1 | .about_container{ 2 | flex-direction: column; 3 | margin-left:30px; 4 | margin-bottom:30px; 5 | margin-top: 10px; 6 | border-bottom: gray solid 0.1px; 7 | font-size: 14px 8 | } 9 | .item1{ 10 | font-size: 18px; 11 | margin-left: 10px 12 | } 13 | .item2{ 14 | font-size:15px; 15 | color: #969696 16 | } 17 | 18 | .contact{ 19 | background-color: #3cc51f; 20 | width: 100dp; 21 | color: white 22 | } -------------------------------------------------------------------------------- /WeChatMiniApp/pages/all_lang/all_lang.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{array[index]}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{item.name}} 23 | 24 | 25 | 26 | {{item.description}} 27 | 28 | 29 | 30 | 31 | {{item.language}} 32 | 33 | {{list[index].stargazers_count}} 34 | 35 | {{item.forks_count}} 36 | 37 | 38 | {{item.owner.login}} 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {{ stared[index] }}赞 48 | 49 | 50 | 51 | 52 | 评论 53 | 54 | 55 | 56 | 分享 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 73 | -------------------------------------------------------------------------------- /WeChatMiniApp/pages/all_lang/all_lang.wxss: -------------------------------------------------------------------------------- 1 | .title{ 2 | color: #4F94CD; 3 | font-weight:bold; 4 | margin-left:10px; 5 | margin-bottom:10px; 6 | padding-bottom: 25px; 7 | font-size: 17px; 8 | margin-top: -10px; 9 | line-height:25px; 10 | } 11 | .jiantou{ 12 | width: 10px; 13 | height: 10px; 14 | margin-left: 10px 15 | } 16 | .primary{ 17 | background-color: black; 18 | color: white; 19 | width: 50px; 20 | margin-left: 10 21 | } 22 | .description{ 23 | margin-top: 10px; 24 | font-size: 14px; 25 | overflow: hidden; 26 | float: left; 27 | margin-left:10px; 28 | line-height:1.5; 29 | color:#0D0D0D 30 | } 31 | .star{ 32 | margin-top: 10px; 33 | float: left; 34 | margin-left:10px; 35 | } 36 | .desc{ 37 | clear: both; 38 | } 39 | .jian{ 40 | margin-top: 10px; 41 | float: right 42 | } 43 | .stars{ 44 | margin-left:2px; 45 | color:#666666; 46 | font-size: 12px; 47 | margin-right: 10px 48 | } 49 | .admin{ 50 | margin-left:4px; 51 | color:#4D4D4D; 52 | font-size: 14px; 53 | margin-right: 20px 54 | } 55 | .best { 56 | /* iOS video-cell margin bug*/ 57 | padding-bottom: 10px; 58 | text-overflow: clip; 59 | vertical-align: middle; 60 | margin-left:35px; 61 | margin-right:auto; 62 | } 63 | .devide{ 64 | height:1px; 65 | width:100%; 66 | background:#C7C7C7; 67 | overflow:hidden; 68 | margin-left: 50px; 69 | margin-bottom: 10px; 70 | } 71 | .container{ 72 | background: #f8f8f8; 73 | box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 5px; 74 | border-radius: 2px; 75 | color: #ff591b; 76 | overflow: hidden; 77 | } 78 | .user_pic{ 79 | width:40px; 80 | height:40px; 81 | border-radius:100px; 82 | margin-left: 10px 83 | } 84 | .flex{ 85 | flex-direction: row 86 | } 87 | 88 | .slide_bar{ 89 | position: fixed; 90 | bottom: 20px; 91 | right: 15px; 92 | z-index: 888; 93 | height: 49px; 94 | font-size: 19px; 95 | text-align: center; 96 | width:49px; 97 | border-radius:100px; 98 | background-color:#000000; 99 | filter:alpha(opacity=80); 100 | -moz-opacity:0.7;opacity: 0.7; 101 | color: #4F94CD 102 | } 103 | .option{ 104 | margin-left:auto; 105 | margin-right:auto; 106 | display:inline-block; 107 | width: 33.33%; 108 | text-align: center 109 | } 110 | .option_menu{ 111 | width:13px; 112 | height:13px; 113 | text-align: center 114 | } 115 | .option_menu_size{ 116 | font-size: 10pt; 117 | margin-left: 5px 118 | } -------------------------------------------------------------------------------- /WeChatMiniApp/pages/code/code.js: -------------------------------------------------------------------------------- 1 | var api = require('../../utils/request_api.js') 2 | var WxParse = require('../../wxParse/wxParse.js'); 3 | // 需要渲染的Markdown文本 4 | var md = '# hello, world\n\nI love you, wemark!'; 5 | var Base64 = require('../../libs/js-base64/base64.modified.js'); 6 | var readme_link; 7 | Page({ 8 | data: { 9 | // 确定一个数据名称 10 | wemark: {} 11 | }, 12 | onLoad(query){ 13 | this.setData({ 14 | hidden: false 15 | }); 16 | console.log(query) 17 | readme_link = query.readme_link 18 | }, 19 | onReady: function () { 20 | const that = this 21 | console.log(api.server_api + 'v1/repos?github=' + readme_link) 22 | wx.request({ 23 | url: api.server_api + 'v1/repos?github=' + readme_link, 24 | success: function (res) { 25 | that.setData({ 26 | hidden:true 27 | }) 28 | const content = ' SyntaxHighlighter Build Test Page

SyntaxHihglighter Test

This is a test file to insure that everything is working well.

 function test() : String { 	return 10; } 
' 29 | 30 | //Base64.decode(res.data.content) 31 | // wemark.parse(content, that, { 32 | // imageWidth: wx.getSystemInfoSync().windowWidth - 50, 33 | // name: 'wemark' 34 | // }) 35 | console.log(content) 36 | WxParse.wxParse('article', 'html', content, that, 5); 37 | } 38 | }) 39 | 40 | } 41 | }); -------------------------------------------------------------------------------- /WeChatMiniApp/pages/code/code.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |