GitHub Profile
将 GitHub 用户或组织资料页解析为结构化 JSON,包含 name、bio、followers、following、public repos、pinned repos 和 organizations。
API 用法
在 Crawling API 请求中添加 &scraper=github-profile。在 url 参数中对目标 URL 进行 URL 编码。
curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
--data-urlencode 'url=https://github.com/karpathy' \
--data-urlencode 'scraper=github-profile' -Gfrom crawlbase import CrawlingAPI
api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
'https://github.com/karpathy',
{'scraper': 'github-profile'}
)
import json
data = json.loads(res['body'])const { CrawlingAPI } = require('crawlbase');
const api = new CrawlingAPI({ token: 'YOUR_TOKEN' });
const res = await api.get(
'https://github.com/karpathy',
{ scraper: 'github-profile' }
);
const data = JSON.parse(res.body);require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')
res = api.get('https://github.com/karpathy', scraper: 'github-profile')
data = JSON.parse(res.body)示例输入 URL
传入 url 参数的 URL(为便于阅读已 URL 解码):
https://github.com/karpathy响应结构
JSON 响应体。当源页面省略对应值时,字段类型可能为 null。
显示名称。
账户登录名(资料页 slug)。
个人简介。
规范的资料页 URL。
关注者数量。
关注中数量。
Repositories 标签页上显示的公开仓库数量。
置顶仓库的名称。
资料页上显示的组织登录名。
示例响应
{
"name": "Andrej",
"username": "karpathy",
"bio": "I like to train Deep Neural Nets on large datasets.",
"url": "https://github.com/karpathy",
"followers": 210000,
"following": 8,
"publicRepos": 63,
"pinnedRepos": ["nanoGPT", "nanochat", "llm.c", "llama2.c", "micrograd", "microgpt"],
"organizations": []
}