MCPcopy
hub / github.com/yhangf/PythonCrawler / hot_github

Function hot_github

spiderFile/github_hot.py:7–18  ·  view source on GitHub ↗
(keyword)

Source from the content-addressed store, hash-verified

5
6
7def hot_github(keyword):
8 url = 'https://github.com/trending/{0}'.format(keyword)
9 main_url = 'https://github.com{0}'
10 html = requests.get(url).content.decode('utf-8')
11 reg_hot_url = re.compile('<h3 class="repo-list-name">\s*<a href="(.*?)">')
12 hot_url = [main_url.format(i) for i in re.findall(reg_hot_url, html)]
13 url_abstract_reg = re.compile('<p class="repo-list-description">\s*(.*?)\s*</p>')
14 summary_text = re.findall(url_abstract_reg, html)
15 hotDF = pd.DataFrame()
16 hotDF['项目简介'] = summary_text
17 hotDF['项目地址'] = hot_url
18 hotDF.to_csv('./github_hot.csv', index=False)
19
20if __name__ == '__main__':
21 keyword = input('请输入查找的热门语言:')

Callers 1

github_hot.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected