find-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese🔍 Find API | 寻找可靠数据源
🔍 Find API | 寻找可靠数据源
The comprehensive guide to reliable data APIs. Stop scraping, start using APIs.跨领域可靠数据 API 的综合指南。停止爬取,开始使用 API。
这是一份覆盖全领域的可靠数据API综合指南。停止网页爬取,开始使用API。
⚠️ Core Principle | 核心原则
⚠️ 核心原则
API First, Scraping Last.
| Priority | Method | When to Use | 优先级 | 方法 | 何时使用 |
|---|---|---|---|---|---|
| 1st | Official API | Always check first | 第一 | 官方 API | 始终优先检查 |
| 2nd | Third-party API | When official API unavailable/expensive | 第二 | 第三方 API | 当官方 API 不可用/太贵 |
| 3rd | Public Dataset | For historical/static data | 第三 | 公共数据集 | 用于历史/静态数据 |
| 4th | Web Scraping | Only as last resort | 第四 | 网页爬取 | 仅作为最后手段 |
优先使用API,网页爬取仅为最后选择。
| 优先级 | 方法 | 何时使用 |
|---|---|---|
| 第一 | 官方API | 始终优先检查 |
| 第二 | 第三方API | 当官方API不可用/费用过高时 |
| 第三 | 公共数据集 | 用于历史/静态数据 |
| 第四 | 网页爬取 | 仅作为最后手段 |
📋 Table of Contents | 目录
📋 目录
1. Stock & Financial Data | 股票与金融数据
1. 股票与金融数据
1.1 A股市场 / Chinese A-Share Market
1.1 A股市场
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | Free | None | Real-time quotes, historical K-lines, financial statements, fund flows, dragon-tiger list |
| Tushare | ⭐⭐⭐⭐⭐ | Free+Paid | Token | Real-time quotes, historical data, financial statements, margin trading |
| East Money API | ⭐⭐⭐⭐ | Free | None | Real-time quotes, fund flows, research reports |
Recommended: AKShare (Best for most use cases)
Installation:
bash
pip install akshareQuick Examples:
python
import akshare as ak| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | 免费 | 无 | 实时行情、历史K线、财务报表、资金流向、龙虎榜 |
| Tushare | ⭐⭐⭐⭐⭐ | 免费+付费 | Token认证 | 实时行情、历史数据、财务报表、融资融券数据 |
| East Money API | ⭐⭐⭐⭐ | 免费 | 无 | 实时行情、资金流向、研究报告 |
推荐:AKShare(适用于大多数使用场景)
安装:
bash
pip install akshare快速示例:
python
import akshare as ak获取A股实时行情
获取A股实时行情
df = ak.stock_zh_a_spot_em()
df = ak.stock_zh_a_spot_em()
获取个股历史数据
获取个股历史数据
df = ak.stock_zh_a_hist(symbol="000001", period="daily", adjust="qfq")
df = ak.stock_zh_a_hist(symbol="000001", period="daily", adjust="qfq")
获取财务指标
获取财务指标
df = ak.stock_financial_analysis_indicator(symbol="000001")
df = ak.stock_financial_analysis_indicator(symbol="000001")
获取资金流向
获取资金流向
df = ak.stock_individual_fund_flow(stock="000001")
**Documentation:** https://akshare.akfamily.xyz
---df = ak.stock_individual_fund_flow(stock="000001")
**文档:** https://akshare.akfamily.xyz
---1.2 港股市场 / Hong Kong Stock Market
1.2 港股市场
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | Free | None | Real-time quotes, historical data |
| Tushare | ⭐⭐⭐⭐ | Free+Paid | Token | Hong Kong stock data |
Recommended: AKShare
Quick Examples:
python
import akshare as ak| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | 免费 | 无 | 实时行情、历史数据 |
| Tushare | ⭐⭐⭐⭐ | 免费+付费 | Token认证 | 港股数据 |
推荐:AKShare
快速示例:
python
import akshare as ak港股实时行情
港股实时行情
df = ak.stock_hk_spot_em()
df = ak.stock_hk_spot_em()
个股历史数据(如腾讯 00700)
个股历史数据(如腾讯 00700)
df = ak.stock_hk_hist(symbol="00700", period="daily", adjust="qfq")
df = ak.stock_hk_hist(symbol="00700", period="daily", adjust="qfq")
港股通资金
港股通资金
df = ak.stock_hk_ggt_components_em()
---df = ak.stock_hk_ggt_components_em()
---1.3 美股市场 / US Stock Market
1.3 美股市场
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| yfinance | ⭐⭐⭐⭐⭐ | Free | None | Real-time quotes, historical data, financials, options |
| Alpha Vantage | ⭐⭐⭐⭐ | Free+Paid | API Key | Quotes, technical indicators, forex |
| Polygon.io | ⭐⭐⭐⭐ | Free+Paid | API Key | Real-time data, options |
Recommended: yfinance (Best free option for US stocks)
Installation:
bash
pip install yfinanceQuick Examples:
python
import yfinance as yf| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| yfinance | ⭐⭐⭐⭐⭐ | 免费 | 无 | 实时行情、历史数据、财务信息、期权数据 |
| Alpha Vantage | ⭐⭐⭐⭐ | 免费+付费 | API Key | 行情、技术指标、外汇数据 |
| Polygon.io | ⭐⭐⭐⭐ | 免费+付费 | API Key | 实时数据、期权数据 |
推荐:yfinance(美股最佳免费选择)
安装:
bash
pip install yfinance快速示例:
python
import yfinance as yf获取股票信息
获取股票信息
stock = yf.Ticker("AAPL")
stock = yf.Ticker("AAPL")
历史数据
历史数据
hist = stock.history(period="1mo")
hist = stock.history(period="1mo")
财务报表
财务报表
financials = stock.financials
balance_sheet = stock.balance_sheet
cashflow = stock.cashflow
financials = stock.financials
balance_sheet = stock.balance_sheet
cashflow = stock.cashflow
股息信息
股息信息
dividends = stock.dividends
dividends = stock.dividends
推荐分析师评级
推荐分析师评级
recommendations = stock.recommendations
**Documentation:** https://github.com/ranaroussi/yfinance
---recommendations = stock.recommendations
**文档:** https://github.com/ranaroussi/yfinance
---1.4 期货与衍生品 / Futures & Derivatives
1.4 期货与衍生品
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | Free | None | Domestic futures, international futures |
| Tushare | ⭐⭐⭐⭐ | Free+Paid | Token | Futures data |
Quick Examples:
python
import akshare as ak| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | 免费 | 无 | 国内期货、国际期货 |
| Tushare | ⭐⭐⭐⭐ | 免费+付费 | Token认证 | 期货数据 |
快速示例:
python
import akshare as ak国内期货主力合约
国内期货主力合约
df = ak.futures_zh_main_sina()
df = ak.futures_zh_main_sina()
国际期货
国际期货
df = ak.futures_foreign_hist(symbol="CL") # 原油
---df = ak.futures_foreign_hist(symbol="CL") # 原油
---1.5 基金数据 / Fund Data
1.5 基金数据
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | Free | None | Open-end funds, ETFs, money funds |
| East Money API | ⭐⭐⭐⭐ | Free | None | Fund rankings, holdings |
Quick Examples:
python
import akshare as ak| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| AKShare | ⭐⭐⭐⭐⭐ | 免费 | 无 | 开放式基金、ETF、货币基金 |
| East Money API | ⭐⭐⭐⭐ | 免费 | 无 | 基金排名、持仓信息 |
快速示例:
python
import akshare as ak开放式基金列表
开放式基金列表
df = ak.fund_open_fund_info_em(fund="000001")
df = ak.fund_open_fund_info_em(fund="000001")
ETF实时行情
ETF实时行情
df = ak.fund_etf_spot_em()
df = ak.fund_etf_spot_em()
基金持仓
基金持仓
df = ak.fund_portfolio_em(fund="000001")
---df = ak.fund_portfolio_em(fund="000001")
---2. Weather Data | 天气数据
2. 天气数据
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| OpenWeatherMap | ⭐⭐⭐⭐⭐ | Free+Paid | API Key | Current weather, forecast, historical |
| WeatherAPI.com | ⭐⭐⭐⭐ | Free+Paid | API Key | Weather, astronomy, sports |
| QWeather 和风天气 | ⭐⭐⭐⭐ | Free+Paid | API Key | 中国地区天气数据 |
Recommended: OpenWeatherMap (Global coverage)
Quick Examples:
python
import requests
api_key = "YOUR_API_KEY"
city = "Beijing"| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| OpenWeatherMap | ⭐⭐⭐⭐⭐ | 免费+付费 | API Key | 当前天气、天气预报、历史天气 |
| WeatherAPI.com | ⭐⭐⭐⭐ | 免费+付费 | API Key | 天气、天文、体育相关天气数据 |
| QWeather 和风天气 | ⭐⭐⭐⭐ | 免费+付费 | API Key | 中国地区天气数据 |
推荐:OpenWeatherMap(全球覆盖)
快速示例:
python
import requests
api_key = "YOUR_API_KEY"
city = "Beijing"当前天气
当前天气
url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
response = requests.get(url)
data = response.json()
print(f"Temperature: {data['main']['temp']}°C")
print(f"Weather: {data['weather'][0]['description']}")
**Get API Key:** https://openweathermap.org/api
---url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
response = requests.get(url)
data = response.json()
print(f"温度: {data['main']['temp']}°C")
print(f"天气状况: {data['weather'][0]['description']}")
**获取API Key:** https://openweathermap.org/api
---3. News & Media | 新闻与媒体
3. 新闻与媒体
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| NewsAPI | ⭐⭐⭐⭐⭐ | Free+Paid | API Key | Global news articles |
| GNews | ⭐⭐⭐⭐ | Free+Paid | API Key | News articles, search |
| MediaStack | ⭐⭐⭐⭐ | Free+Paid | API Key | News data |
Recommended: NewsAPI
Quick Examples:
python
import requests
api_key = "YOUR_API_KEY"| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| NewsAPI | ⭐⭐⭐⭐⭐ | 免费+付费 | API Key | 全球新闻文章 |
| GNews | ⭐⭐⭐⭐ | 免费+付费 | API Key | 新闻文章、新闻搜索 |
| MediaStack | ⭐⭐⭐⭐ | 免费+付费 | API Key | 新闻数据 |
推荐:NewsAPI
快速示例:
python
import requests
api_key = "YOUR_API_KEY"获取头条新闻
获取头条新闻
url = f"https://newsapi.org/v2/top-headlines?country=us&apiKey={api_key}"
response = requests.get(url)
articles = response.json()['articles']
for article in articles[:5]:
print(article['title'])
**Get API Key:** https://newsapi.org
---url = f"https://newsapi.org/v2/top-headlines?country=us&apiKey={api_key}"
response = requests.get(url)
articles = response.json()['articles']
for article in articles[:5]:
print(article['title'])
**获取API Key:** https://newsapi.org
---4. Maps & Geolocation | 地图与地理定位
4. 地图与地理定位
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| OpenStreetMap Nominatim | ⭐⭐⭐⭐⭐ | Free | None | Geocoding, reverse geocoding |
| 高德地图 API | ⭐⭐⭐⭐⭐ | Free+Paid | API Key | 中国地区地图、导航、POI |
| 百度地图 API | ⭐⭐⭐⭐ | Free+Paid | API Key | 中国地区地图、导航 |
| Google Maps API | ⭐⭐⭐⭐ | Paid | API Key | Global maps, places, routes |
Recommended: Nominatim (Free, no auth) | 高德地图 (中国地区)
Nominatim Quick Examples:
python
import requests| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| OpenStreetMap Nominatim | ⭐⭐⭐⭐⭐ | 免费 | 无 | 地理编码、逆地理编码 |
| 高德地图API | ⭐⭐⭐⭐⭐ | 免费+付费 | API Key | 中国地区地图、导航、POI信息 |
| 百度地图API | ⭐⭐⭐⭐ | 免费+付费 | API Key | 中国地区地图、导航 |
| Google Maps API | ⭐⭐⭐⭐ | 付费 | API Key | 全球地图、地点信息、路线规划 |
推荐:Nominatim(免费无需认证)| 高德地图API(中国地区)
Nominatim快速示例:
python
import requests地理编码(地址转坐标)
地理编码(地址转坐标)
address = "Beijing, China"
url = f"https://nominatim.openstreetmap.org/search?q={address}&format=json"
response = requests.get(url, headers={'User-Agent': 'AgentApp'})
data = response.json()
print(f"Lat: {data[0]['lat']}, Lon: {data[0]['lon']}")
**高德地图 Quick Examples:**
```python
import requests
api_key = "YOUR_API_KEY"
address = "北京市朝阳区"address = "Beijing, China"
url = f"https://nominatim.openstreetmap.org/search?q={address}&format=json"
response = requests.get(url, headers={'User-Agent': 'AgentApp'})
data = response.json()
print(f"纬度: {data[0]['lat']}, 经度: {data[0]['lon']}")
**高德地图快速示例:**
```python
import requests
api_key = "YOUR_API_KEY"
address = "北京市朝阳区"地理编码
地理编码
url = f"https://restapi.amap.com/v3/geocode/geo?address={address}&key={api_key}"
response = requests.get(url)
data = response.json()
print(data['geocodes'][0]['location'])
**Get 高德 API Key:** https://lbs.amap.com
---url = f"https://restapi.amap.com/v3/geocode/geo?address={address}&key={api_key}"
response = requests.get(url)
data = response.json()
print(data['geocodes'][0]['location'])
**获取高德API Key:** https://lbs.amap.com
---5. E-commerce & Products | 电商与商品
5. 电商与商品
| API | Rating | Cost | Auth | Data Coverage |
|---|---|---|---|---|
| 淘宝开放平台 | ⭐⭐⭐⭐ | Free+Paid | OAuth | 商品搜索, 订单 |
| 京东开放平台 | ⭐⭐⭐⭐ | Free+Paid | OAuth | 商品, 订单, 物流 |
| Barcode Lookup | ⭐⭐⭐ | Free+Paid | API Key | Product info by barcode |
Note: 电商API通常需要商家认证,普通用户可考虑爬取商品页面或使用第三方服务。
| API | 评分 | 成本 | 认证要求 | 数据覆盖范围 |
|---|---|---|---|---|
| 淘宝开放平台 | ⭐⭐⭐⭐ | 免费+付费 | OAuth认证 | 商品搜索、订单管理 |
| 京东开放平台 | ⭐⭐⭐⭐ | 免费+付费 | OAuth认证 | 商品、订单、物流信息 |
| Barcode Lookup | ⭐⭐⭐ | 免费+付费 | API Key | 通过条形码查询商品信息 |
注意: 电商API通常需要商家认证,普通用户可考虑爬取商品页面或使用第三方服务。
6. More domains coming soon... | 更多领域持续完善中
6. 更多领域持续完善中
Planned additions:
- Social Media APIs (Twitter, Weibo, Reddit)
- Translation APIs
- Image & Video APIs
- Scientific & Research Data APIs
- Government & Public Data APIs
- Real Estate Data APIs
- Job & Recruitment APIs
Contribute: If you know reliable APIs in other domains, help expand this skill!
计划新增领域:
- 社交媒体API(Twitter、微博、Reddit)
- 翻译API
- 图片与视频API
- 科研数据API
- 政府与公共数据API
- 房地产数据API
- 招聘求职API
贡献: 如果你了解其他领域的可靠API,欢迎参与完善本指南!
🔄 Decision Flow | 决策流程
🔄 决策流程
用户需要获取外部数据
↓
Step 1: 确定数据类型
├── 股票/金融 → 查看本 Skill 第1节
├── 天气 → 查看本 Skill 第2节
├── 新闻 → 查看本 Skill 第3节
├── 地图/位置 → 查看本 Skill 第4节
├── 电商/商品 → 查看本 Skill 第5节
└── 其他 → 搜索 RapidAPI / Public APIs
↓
Step 2: 选择合适的 API
├── 考虑因素:成本、认证难度、数据覆盖、稳定性
└── 优先选择免费/免认证的 API
↓
Step 3: 检查环境
├── Python库是否安装?→ pip install xxx
└── API Key是否获取?→ 引导用户注册
↓
Step 4: 调用 API 获取数据
↓
Step 5: 返回结构化结果用户需要获取外部数据
↓
步骤1: 确定数据类型
├── 股票/金融 → 查看本指南第1节
├── 天气 → 查看本指南第2节
├── 新闻 → 查看本指南第3节
├── 地图/位置 → 查看本指南第4节
├── 电商/商品 → 查看本指南第5节
└── 其他 → 搜索RapidAPI / Public APIs
↓
步骤2: 选择合适的API
├── 考虑因素:成本、认证难度、数据覆盖范围、稳定性
└── 优先选择免费/免认证的API
↓
步骤3: 检查环境
├── Python库是否已安装?→ pip install xxx
└── API Key是否已获取?→ 引导用户注册获取
↓
步骤4: 调用API获取数据
↓
步骤5: 返回结构化结果📊 Before vs After Comparison | 效果对比
📊 效果对比
| Metric | Web Scraping | Using API |
|---|---|---|
| Speed | 30-60 seconds | 1-3 seconds |
| Token Cost | High (entire HTML) | Low (JSON only) |
| Accuracy | Low (parsing errors) | High (structured data) |
| Reliability | Low (anti-scraping) | High (stable API) |
| Maintenance | High (page changes) | Low (stable API) |
| 指标 | 网页爬取 | 使用 API |
|---|---|---|
| 速度 | 30-60 秒 | 1-3 秒 |
| Token 成本 | 高(整个页面) | 低(仅 JSON) |
| 准确性 | 低(解析错误) | 高(结构化数据) |
| 稳定性 | 低(反爬机制) | 高(稳定接口) |
| 维护成本 | 高(页面变化) | 低(稳定接口) |
| 指标 | 网页爬取 | 使用API |
|---|---|---|
| 速度 | 30-60秒 | 1-3秒 |
| Token成本 | 高(需处理整个HTML页面) | 低(仅接收JSON数据) |
| 准确性 | 低(易出现解析错误) | 高(结构化数据) |
| 稳定性 | 低(易触发反爬机制) | 高(API接口稳定) |
| 维护成本 | 高(页面结构变化需调整) | 低(API接口稳定) |
🔧 General Setup | 通用安装
🔧 通用环境配置
Most APIs in this skill require Python. Basic setup:
bash
undefined本指南中的大多数API需要使用Python,基础配置如下:
bash
undefined常用数据获取库
常用数据获取库
pip install akshare yfinance requests pandas
pip install akshare yfinance requests pandas
可选:更多数据源
可选:更多数据源库
pip install tushare
undefinedpip install tushare
undefined🔍 External Resources | 外部资源
🔍 外部资源
If the data type is not covered in this skill, search these directories:
| Resource | URL | Description |
|---|---|---|
| RapidAPI | https://rapidapi.com/hub | Largest API marketplace |
| Public APIs | https://github.com/public-apis/public-apis | Free public APIs list |
| ProgrammableWeb | https://www.programmableweb.com | API directory |
如果所需数据类型未在本指南中覆盖,可搜索以下API目录:
| 资源 | 网址 | 描述 |
|---|---|---|
| RapidAPI | https://rapidapi.com/hub | 最大的API交易市场 |
| Public APIs | https://github.com/public-apis/public-apis | 免费公共API列表 |
| ProgrammableWeb | https://www.programmableweb.com | API目录网站 |
📝 Version | 版本
📝 版本信息
- Version: 1.0.0
- Created: 2026-03-13
- Last Updated: 2026-03-13
- Maintainer: Community
- Contribution: Welcome to add more reliable data sources
Remember: API First, Scraping Last.
- 版本:1.0.0
- 创建时间:2026-03-13
- 最后更新时间:2026-03-13
- 维护者:社区
- 贡献:欢迎添加更多可靠数据源
记住:优先使用API,网页爬取仅为最后选择。