|
1 주 전 | |
---|---|---|
application | 1 주 전 | |
configs | 2 주 전 | |
test | 1 주 전 | |
utils | 1 주 전 | |
.env.prod | 1 주 전 | |
.env.test | 1 주 전 | |
.gitignore | 2 주 전 | |
README.md | 1 주 전 | |
main.py | 1 주 전 | |
run.sh | 1 주 전 |
一个基于 YAML 配置驱动的通用分布式爬虫系统,支持多 Topic 并发消费,按平台灵活执行爬虫逻辑,最终推送至 ETL 消费系统。
AutoScraperX/
├── main.py # 项目入口:监听 MQ 消息,调度 UniversalCrawler
├── spiders/
│ ├── universal_crawler.py # 通用爬虫主类,读取配置并执行爬虫逻辑
│ └── rabbitmq_consumer.py # 多线程消费 MQ 中的消息并执行任务
├── configs/
│ ├── spiders_config.yaml # 各平台爬虫规则配置文件(含 JsonPath)
│ └── topic_map.yaml # topic 与平台名映射关系配置
├── application/
│ ├── common/ # 各种工具模块(日志、GPT、FFmpeg、代理池、Feishu 等)
│ ├── config/ # 全局配置
│ ├── mysql/redis/ # 数据库与缓存工具模块
│ ├── messageQueue/ # MQ 消费/ACK 工具模块
│ ├── functions/ # 各类通用工具函数与日志记录
│ ├── items/ # 爬取的数据结构定义
│ └── pipeline/ # 数据处理与入库管道
├── scheduler/
│ └── scheduler_main.py # 预留任务调度扩展入口(支持定时任务)
├── utils/
│ ├── config_loader.py # YAML 配置加载工具
│ └── project_paths.py # 自动定位 config、log 路径等
VideoItem
,统一推送到 MQUniversalCrawler
pipeline
处理spiders_config.yaml
:各平台请求方式、字段映射、分页等配置topic_map.yaml
:多 Topic 映射(暂不再使用 platform 字段)python main.py
程序将自动监听所有 Topic,消费消息后创建对应的爬虫任务并执行。
default:
base_url: http://api.xxx.com
request_timeout: 30[]()
headers:
{"Content-Type": "application/json"}
benshanzhufu:
mode: recommend
path: /crawler/ben_shan_zhu_fu/recommend
method: post
request_body:
cursor: "1"
paging: true
max_pages: 5
etl_hook: "process_video_obj"
response_parse:
next_cursor: "$.data.next_cursor"
data_path: "$.data.data"
fields:
video_id: "$.nid"
video_title: "$.title"
play_cnt: 0
publish_time: "$.update_time"
video_url: "$.video_url"
.run()
,完成后再 ACK