https://github.com/hellogithub-team/hydra
简单但绝不简陋的 Python3 爬虫项目,集合 HelloGitHub 所有平台的账号信息。会基础的 Python 语法就能看懂!
https://github.com/hellogithub-team/hydra
python spider
Last synced: 10 months ago
JSON representation
简单但绝不简陋的 Python3 爬虫项目,集合 HelloGitHub 所有平台的账号信息。会基础的 Python 语法就能看懂!
- Host: GitHub
- URL: https://github.com/hellogithub-team/hydra
- Owner: HelloGitHub-Team
- Created: 2019-07-10T02:20:51.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2023-03-21T22:49:45.000Z (over 3 years ago)
- Last Synced: 2025-04-13T10:50:25.109Z (about 1 year ago)
- Topics: python, spider
- Language: Python
- Homepage: https://hellogithub.com
- Size: 718 KB
- Stars: 203
- Watchers: 6
- Forks: 40
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hydra(九头蛇)
简单但绝不简陋的 Python3 爬虫项目。
参考「建立完美的 Python 项目」 创建
Hydra 力求用最简单的代码实现聚合 HG 多平台的数据。
从本项目中你可以看到:**熟悉的 [Python 基础语法](https://github.com/521xueweihan/python)**、**如何编写爬虫**、**操作数据库**、**常用第三库**、**分析网页**、**解析接口**、**编写单元测试**、**mock 请求**、**异常监控和管理**、**保证代码质量的自动化**、**GitHub Action** 等实战应用。
此项目是汇集「HelloGitHub」在每个平台的账号和内容数据,方便我们的作者们看到自己作品的数据([投稿吗?](https://www.yuque.com/docs/share/bf781d29-cc94-44dd-b226-9d70fa38fa1c))。支持平台:[博客园](https://www.cnblogs.com/xueweihan/)、[头条](https://www.toutiao.com/c/user/token/MS4wLjABAAAAigrrKo-3rjLpxaH4Go3BrZRqHTIhLW3e30QjfFXgzNQ/)、[知乎](https://www.zhihu.com/people/xueweihan)、[掘金](https://juejin.cn/user/1574156384091320)、[即刻](https://web.okjike.com/u/ff31a838-6eb9-440d-9970-dabc5b2c0309) 等。
你要[加入](https://mp.weixin.qq.com/s/9FUQ2i0HbemwfIj9sa1p0A)我们吗?
## 一、运行
> 基于 Python 3.9.1 实现,理论上支持 3.7.5+
首先,下载项目:`git clone` or [点击下载 zip 包](https://github.com/HelloGitHub-Team/Hydra/archive/main.zip)
然后,在项目根目录创建配置文件,[.local_env.yaml](/doc/local_env.yaml)。
最后,把玩起来吧!
1. 安装 poetry:`pip install poetry`
2. 安装依赖:在项目根目录执行 `poetry install --no-root`
3. 运行单个爬虫:`poetry run python main.py wechat|cnblogs|toutiao|csdn|zhihu|juejin|jike`
运行遇到问题和更多说明[点这里](/doc/install.md),贡献代码[看这里](/doc/contribute.md)
## 二、展示
比如:查看某一日发布的原创文章数据
```
SELECT
summary ,
clicks_count ,
platform ,
publish_date
FROM
hydra_content
WHERE
content_type = "article"
AND publish_date = "2021-03-01"
AND(
is_original = 1
OR is_original IS NULL
);
```
```
+-----------------------------------------+----------------+------------+----------------+
| summary | clicks_count | platform | publish_date |
|-----------------------------------------+----------------+------------+----------------|
| 更新啦!第 59 期《HelloGitHub》开源月刊 | 77 | csdn | 2021-03-01 |
| 更新啦!第 59 期《HelloGitHub》月刊 | 5133 | wechat | 2021-03-01 |
| 更新啦!第 59 期《HelloGitHub》开源月刊 | 1022 | cnblogs | 2021-03-01 |
| 更新啦!第 59 期《HelloGitHub》开源月刊 | 1053 | toutiao | 2021-03-01 |
| 更新啦!第 59 期《HelloGitHub》开源月刊 | 1879 | zhihu | 2021-03-01 |
| 更新啦!第 59 期《HelloGitHub》开源月刊 | 931 | juejin | 2021-03-01 |
+-----------------------------------------+----------------+------------+----------------+
6 rows in set
Time: 0.050s
```
## 三、声明

本作品采用 署名-非商业性使用-禁止演绎 4.0 国际 进行许可。