Python github
def get_search_github(keyword, language, pageIndex): params = { "q" : keyword, "type": "Repositories", "l": language, "p": pageIndex } p = urllib.parse.urlencode(params) url = r"https://github.com/search?" + p return url def get_github_source_stars(url): html= requests.get(url) response = html.content.decode("utf-8") getDataPattern = r‘repo-list-item[\s|\S]*?mt-n1[\s|\S]*?f4 text-normal">[\s|\S]*?>([\s|\S]*?)</a>[\s|\S]*?mb-1">([\s|\S]+?)</p>[\s|\S]*?octicon octicon-star[\s|\S]*?</path></svg>\s+(\S+)[\s|\S]*?programmingLanguage">(\S+)</span>‘ resultList = re.findall(getDataPattern, response) SourceList = [] for item in resultList: star = str(item[2]).lstrip() k = False star_count = star if (star.lower().endswith("k")): k = True star_count = star.lower().replace("k", "").lstrip() star_count = float(star_count) if k: star_count *= 1000 sItem = {"title": str(item[0]).lstrip(), "language": str(item[3]).lstrip(), "description": str(item[1]).lstrip(), "stars": star, "start_count": int(star_count) } SourceList.append(sItem) return SourceList
for page in range(1, 15): url = get_search_github(r"stars:>10000", "python", page) alist = get_github_source_stars(url)
相关推荐
HeyShHeyou 2020-11-17
86193952 2020-10-27
小木兮子 2020-11-11
seanzed 2020-10-15
huangliuyu00 2020-09-24
libaoshan 2020-09-11
zhangpan 2020-09-10
chongxiaocheng 2020-08-16
xcguoyu 2020-08-15
Qizonghui 2020-08-02
ldcwang 2020-07-26
mqfcu 2020-07-21
jeason 2020-07-20
sunzhihaofuture 2020-07-19
knightwatch 2020-07-19
点滴技术生活 2020-07-19
Reiki 2020-07-06