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)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
爬虫开发_基于Python实现爬取github上热门语言对应的项目.zip (1个子文件)
爬虫开发_基于Python实现爬取github上热门语言对应的项目
github_hot.py 798B
共 1 条
- 1
资源评论
m0_57195758
- 粉丝: 780
- 资源: 255
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功