一个专业的爬虫工具包,提供了一系列用于爬虫开发的实用工具。
- 文件处理工具
- OSS存储管理
- Redis缓存管理
- Ragflow集成
- 时间工具
- User-Agent工具
- XPath工具
- 正则工具
pip install spider_tool- 克隆仓库:
git clone https://github.com/6210qwe/spider_tool.git
cd spider_tool- 创建虚拟环境:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows- 安装开发依赖:
pip install -e ".[dev]"from spider_tool import FileUtils, OSSManager, RedisManager
# 文件处理
valid_filename = FileUtils.validate_and_fix_filename("test/file:name.txt")
# OSS存储
oss_manager = OSSManager(
db_config={
'host': 'localhost',
'user': 'root',
'password': 'password',
'database': 'test'
},
endpoint='oss-cn-hangzhou.aliyuncs.com',
bucket_name='test-bucket'
)
# Redis缓存
redis_manager = RedisManager(host='localhost', port=6379)black .
isort .mypy .pytest构建文档:
cd docs
make htmlMIT License