- 智能網頁爬蟲,支援多層次深度爬取
- 使用 Google Gemini AI 進行內容分析
- 支援動態網頁爬取(Selenium)和靜態網頁爬取
- 自動提取相關連結並遞迴爬取
- 將網頁內容轉換為結構化的 Markdown 格式
- 防止重複爬取相同網頁
pip install -r requirements.txt主要依賴:
- google.generativeai
- beautifulsoup4
- selenium
- cloudscraper
- html2text
- python-dotenv
- 創建
.env檔案並設定:
GEMINI_API_KEY=your_gemini_api_key- 確保已安裝 Chrome 瀏覽器(用於 Selenium)
from src.main import crawl_with_depthbase_url = "https://example.com"
user_query = "你的查詢需求"result = crawl_with_depth(user_query, base_url, max_depth=2)DeepCrawlAI/
├── src/
│ ├── core/
│ │ ├── crawler.py # 爬蟲核心功能
│ │ └── gemini.py # Gemini AI 整合
│ └── main.py # 主程式
├── .env # 環境變數
└── README.md
- 請確保遵守目標網站的爬蟲政策
- 建議設定適當的爬取延遲,避免對目標網站造成負擔
- Gemini API 可能有使用限制,請注意配額使用情況
本專案採用 MIT 授權條款 - 詳見 LICENSE 檔案