登录

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' -G
from 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

name
string | null
显示名称。
username
string | null
账户登录名(资料页 slug)。
bio
string | null
个人简介。
url
string
规范的资料页 URL。
followers
integer | null
关注者数量。
following
integer | null
关注中数量。
publicRepos
integer | null
Repositories 标签页上显示的公开仓库数量。
pinnedRepos
array
置顶仓库的名称。
organizations
array
资料页上显示的组织登录名。

示例响应

{
  "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": []
}