WebRover Dataset
收藏资源简介:
WebRover数据集是通过智能网页抓取技术自动收集、清理和结构化网页内容生成的,专门用于训练大型语言模型和AI应用。数据集支持多种输入格式,如JSON、YAML、TXT和Markdown,并以结构化的JSONL格式输出,适合模型训练。
The WebRover Dataset is generated by automatically collecting, cleaning, and structuring web content via intelligent web scraping technologies, and is specifically designed for training large language models and AI applications. The dataset supports multiple input formats including JSON, YAML, TXT and Markdown, and outputs structured JSONL format which is suitable for model training.
WebRover 🚀
数据集生成工具
WebRover 是一个强大的Python库,用于从网页内容生成高质量的数据集,专门设计用于训练大型语言模型和AI应用。
主要功能
- 智能网页抓取:根据主题自动查找和抓取相关内容。
- 多输入格式支持:支持JSON、YAML、TXT和Markdown格式的主题文件。
- 异步处理:内置速率限制的快速并发抓取。
- 质量控制:内置内容验证和清理。
- LLM准备输出:结构化的JSONL格式,非常适合模型训练。
- 错误处理:强大的错误跟踪和恢复机制。
重要注意事项
云环境兼容性
在使用Google Colab或Kaggle Notebooks等云环境时,可能需要处理嵌套的asyncio循环。解决方法如下:
-
安装
nest_asyncio: bash pip install nest_asyncio -
在笔记本开始时添加以下代码: python import nest_asyncio nest_asyncio.apply()
快速开始
安装
bash pip install webrover
基本用法
python from webrover import WebRover
初始化WebRover
rover = WebRover()
从主题抓取内容
rover.scrape_topics( topics=["artificial intelligence", "machine learning"], sites_per_topic=20 # 每个主题获取20个站点 )
保存数据集
rover.save_dataset("my_dataset.jsonl")
使用主题文件
python
从JSON文件
rover.scrape_topics( topics="topics.json", num_websites=100 )
从Markdown列表
rover.scrape_topics( topics="topics.md", num_websites=100 )
支持的主题文件格式
JSON
json { "topics": [ "AI basics", "machine learning", "deep learning" ] }
YAML
yaml topics:
- AI basics
- machine learning
- deep learning
Markdown
- AI basics
- machine learning
- deep learning
输出结构
python { url: https://example.com/article, title: Article Title, content: Article content..., metadata: { length: 1234, has_title: true, domain: example.com } }
输出文件
final_dataset/dataset.jsonl:主数据集,JSONL格式。websites_master.json:所有发现的URL列表。websites_completed.json:成功抓取的URL。websites_errors.json:失败的尝试,包含错误详情。
错误处理
WebRover自动处理常见问题:
- 速率限制
- 网络超时
- 无效URL
- 被阻止的请求
- 格式错误的内容
限制
- 遵守robots.txt和站点速率限制。
- 某些站点可能阻止自动化访问。
- 大型数据集需要更多处理时间。
- Google搜索可能会限制过多的请求。




