Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
21 lines (19 loc) · 797 Bytes

File metadata and controls

21 lines (19 loc) · 797 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import re
import requests
import pandas as pd
import numpy as np
def hot_github(keyword):
url = 'https://github.com/trending/{0}'.format(keyword)
main_url = 'https://github.com{0}'
html = requests.get(url).content.decode('utf-8')
reg_hot_url = re.compile('<h3 class="repo-list-name">\s*<a href="(.*?)">')
hot_url = [main_url.format(i) for i in re.findall(reg_hot_url, html)]
url_abstract_reg = re.compile('<p class="repo-list-description">\s*(.*?)\s*</p>')
summary_text = re.findall(url_abstract_reg, html)
hotDF = pd.DataFrame()
hotDF['项目简介'] = summary_text
hotDF['项目地址'] = hot_url
hotDF.to_csv('./github_hot.csv', index=False)
if __name__ == '__main__':
keyword = input('请输入查找的热门语言:')
hot_github(keyword)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.