英语| 中文版
该项目提供了一个功能强大的Web刮擦工具,可使用FastAPI,Searxng和Browserless获取搜索结果并将其转换为Markdown格式。它包括使用代理进行Web刮擦和处理HTML内容转换以有效降级的能力。现在具有用于过滤搜索结果的AI集成。替代方案包括Jina.ai,FireCrawl AI,EXA AI和2markDown,为开发人员提供各种网络刮擦和搜索引擎解决方案。
确保您安装了以下内容:
您可以使用Docker简化设置过程。请按照以下步骤:
克隆存储库:
git clone https://github.com/essamamdani/search-result-scraper-markdown.git
cd search-result-scraper-markdown运行Docker组成:
docker compose up --build使用此设置,如果更改.env或main.py文件,则不再需要重新启动Docker。更改将自动重新加载。
按照以下步骤进行手动设置:
克隆存储库:
git clone https://github.com/essamamdani/search-result-scraper-markdown.git
cd search-result-scraper-markdown创建和激活虚拟环境:
virtualenv venv
source venv/bin/activate安装依赖项:
pip install -r requirements.txt在根目录中创建一个.ENV文件,其中包含以下内容:
SEARXNG_URL=http://searxng:8080
BROWSERLESS_URL=http://browserless:3000
TOKEN=your_browserless_token_here # Replace with your actual token
# PROXY_PROTOCOL=http
# PROXY_URL=your_proxy_url
# PROXY_USERNAME=your_proxy_username
# PROXY_PASSWORD=your_proxy_password
# PROXY_PORT=your_proxy_port
REQUEST_TIMEOUT=30
# AI Integration for search result filter
FILTER_SEARCH_RESULT_BY_AI=true
AI_ENGINE=groq
# GROQ
GROQ_API_KEY=yours_groq_api_key_here
GROQ_MODEL=llama3-8b-8192
# OPENAI
# OPENAI_API_KEY=your_openai_api_key_here
# OPENAI_MODEL=gpt-3.5-turbo-0125运行用于Searxng和无浏览器的Docker容器:
./run-services.sh启动FastAPI应用程序:
uvicorn main:app --host 0.0.0.0 --port 8000要执行搜索查询,请将get请求发送到根端点/使用查询参数q (搜索查询), num_results (结果数)和format (json中的get wets wet onsect或默认情况下)。
例子:
curl " http://localhost:8000/?q=python&num_results=5&format=json " # for JSON format
curl " http://localhost:8000/?q=python&num_results=5 " # by default Markdown要将特定URL的内容获取并将其转换为Markdown,请将get请求发送到/r/{url:path} endpoint。
例子:
curl " http://localhost:8000/r/https://example.com&format=json " # for JSON format
curl " http://localhost:8000/r/https://example.com " # by default Markdown要获取图像搜索结果,请使用查询参数q (搜索查询)和num_results (结果数)将GET请求发送到/images端点。
例子:
curl " http://localhost:8000/images?q=puppies&num_results=5 "要获取视频搜索结果,请使用查询参数q (搜索查询)和num_results (结果数)将get请求发送到/videos端点。
例子:
curl " http://localhost:8000/videos?q=cooking+recipes&num_results=5 " 该项目使用Geonode代理进行网络刮擦。您可以使用我的Geonode会员链接开始其代理服务。
有关代码的详细说明,请访问此处的文章。
该项目已根据MIT许可获得许可。有关详细信息,请参见许可证文件。
essa mamdani -essamamdani.com
欢迎捐款!请随时提交拉动请求。