Skip to main content

国自然大数据平台智能爬虫 - AI驱动的基金项目数据采集工具

Project description

NSFC Spider - 国自然大数据平台智能爬虫

🕷️ AI驱动的国家自然科学基金项目数据采集工具

基于 browser-use 框架,使用大语言模型智能理解网页结构,自动适应页面变化。

特性

  • 🤖 AI 驱动:使用 LLM 理解网页,自动适应页面变化
  • 💬 对话式 CLI:交互式命令行界面
  • 🔧 灵活配置:支持多种 LLM 提供商
  • 📊 结构化输出:JSON/CSV/Markdown 格式导出

安装

方式一:使用 pip 安装(推荐)

# 1. 安装包
pip install nsfc-spider

# 2. 安装浏览器
playwright install chromium

方式二:从源码安装

# 1. 克隆仓库
git clone https://github.com/yourusername/nsfc-spider.git
cd nsfc-spider

# 2. 安装依赖
pip install -e .

# 3. 安装 Playwright 浏览器
playwright install chromium

配置

快速配置(推荐)

安装后首次运行,使用交互式配置:

nsfc-spider

在 CLI 中输入 /config 按提示配置 LLM API。

手动配置

创建配置文件 config/.env.env

# LLM 配置
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o
LLM_API_KEY=your-api-key-here
LLM_BASE_URL=https://api.openai.com/v1

# 浏览器配置
HEADLESS=false

获取 API Key

详细配置说明请查看 配置指南

快速开始

使用命令行工具

# 安装后直接运行
nsfc-spider

# 或使用 Python 模块方式
python -m nsfc_spider.cli

开发模式运行

# 从源码目录运行
cd nsfc-spider
python run.py

CLI 命令

nsfc> help          # 查看帮助
nsfc> config        # 配置 LLM 和浏览器
nsfc> search 智慧港口    # 搜索项目
nsfc> search 人工智能 -p 3  # 搜索并爬取3页
nsfc> task <自然语言任务>   # 执行自定义任务
nsfc> status        # 查看配置状态
nsfc> exit          # 退出

支持的 LLM

  • OpenAI (gpt-4o, gpt-4o-mini)
  • Anthropic (claude-sonnet-4)
  • DeepSeek
  • Ollama (本地模型)

项目结构

nsfc-spider/
├── src/nsfc_spider/
│   ├── __init__.py
│   ├── agent.py      # Agent 封装
│   ├── config.py     # 配置管理
│   ├── cli/          # CLI 模块
│   └── tasks/        # 爬取任务
│       ├── direct_scraper.py   # 直接爬取
│       ├── nsfc_search.py      # AI搜索
│       ├── analyzer.py         # 数据分析
│       ├── llm_filter.py       # LLM筛选
│       └── review_generator.py # 综述生成
├── config/
│   └── .env.example
├── tests/            # 测试文件
├── docs/             # 文档
├── run.py            # 开发入口
├── main.py           # 打包入口
└── pyproject.toml    # 项目配置

文档

许可证

MIT License - 详见 LICENSE 文件

贡献

欢迎提交 Issue 和 Pull Request!查看 贡献指南 了解详情。

更新日志

查看 CHANGELOG.md 了解版本更新历史。

致谢

联系方式

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsfc_spider-0.1.5.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nsfc_spider-0.1.5-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file nsfc_spider-0.1.5.tar.gz.

File metadata

  • Download URL: nsfc_spider-0.1.5.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for nsfc_spider-0.1.5.tar.gz
Algorithm Hash digest
SHA256 128576884b11aeeaa7f7b1353337390ec78202edd31c99d237f6eebcffb302ff
MD5 397f6b5bf63a3434d3092e9e42e1727f
BLAKE2b-256 6b4f808a1eefd5b2ca2d8278484428c0843bd8044aff7b89e479dc3ba3aad727

See more details on using hashes here.

File details

Details for the file nsfc_spider-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: nsfc_spider-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for nsfc_spider-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc09f52efb1dfc75759e742cfa90d5f59a948691e2a38ca9af32d33f9c0a8fd
MD5 088d5d3473b13319217490cd8c796659
BLAKE2b-256 46a9dbcd66a78220e4f492b80139845bf4b4441930bba0b377548a0b115868da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page