crawlbase文档
登录

API 用法

Crawling API 请求中添加 &scraper=exercism-solutions。在 url 参数中对目标 URL 进行 URL 编码。该列表已分页(每页 24 条);在目标 URL 上传入 ?page=N 查询参数以获取后续页面。

curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://exercism.org/tracks/ruby/exercises/two-fer/solutions' \
  --data-urlencode 'scraper=exercism-solutions' -G
from crawlbase import CrawlingAPI

api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://exercism.org/tracks/ruby/exercises/two-fer/solutions',
    {'scraper': 'exercism-solutions'}
)

import json
data = json.loads(res['body'])
const { CrawlingAPI } = require('crawlbase');
const api = new CrawlingAPI({ token: 'YOUR_TOKEN' });

const res = await api.get(
  'https://exercism.org/tracks/ruby/exercises/two-fer/solutions',
  { scraper: 'exercism-solutions' }
);
const data = JSON.parse(res.body);
require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')

res = api.get('https://exercism.org/tracks/ruby/exercises/two-fer/solutions', scraper: 'exercism-solutions')
data = JSON.parse(res.body)

示例输入 URL

url 参数支持任意 Exercism 练习社区解决方案页面 - 即 /tracks/<track>/exercises/<slug>/solutions 的页面,可选择附加 ?page=N 查询参数。例如:

https://exercism.org/tracks/ruby/exercises/two-fer/solutions
https://exercism.org/tracks/go/exercises/hello-world/solutions
https://exercism.org/tracks/python/exercises/leap/solutions?page=2

响应结构

JSON 响应体。当源页面省略对应值时,字段类型可能为 null

url
string
被抓取的解决方案列表页面的 URL。
track
object
从第一条解决方案记录提取的轨道上下文。
track.title
string | null
轨道显示标题(例如 Ruby)。
track.iconUrl
string | null
轨道图标的 URL。
exercise
object
从第一条解决方案记录提取的练习上下文。
exercise.title
string | null
练习显示标题。
exercise.iconUrl
string | null
练习图标的 URL。
page
integer | null
当前返回列表的页码(从 1 开始)。
totalPages
integer | null
该练习解决方案的总页数。
totalCount
integer | null
该练习已发布解决方案的总数。
solutionCount
integer
本页 solutions 中返回的解决方案数量。
solutions
array
本页的已发布解决方案,按列表顺序排列。
solutions[].uuid
string
Exercism 解决方案 UUID。
solutions[].author
object
解决方案的作者。
solutions[].author.handle
string
作者用户名(Exercism username)。
solutions[].author.avatarUrl
string | null
作者头像的 URL。
solutions[].author.flair
string | null
作者荣誉徽章(例如 insider),无则为 null。
solutions[].language
string
解决方案的编程语言。
solutions[].numStars
integer
解决方案的星标数量。
solutions[].numComments
integer
解决方案的评论数量。
solutions[].numViews
integer
解决方案的浏览数量。
solutions[].numIterations
integer
作者提交的迭代次数。
solutions[].numLoc
integer | null
解决方案的代码行数,未报告时为 null。
solutions[].isOutOfDate
boolean
当解决方案与当前练习不同步(过时)时为 true。
solutions[].publishedAt
string | null
解决方案的发布时间(ISO 8601),缺失时为 null。
solutions[].snippet
string | null
解决方案的简短代码片段预览,缺失时为 null。
solutions[].url
string | null
单个解决方案页面的公开 URL,缺失时为 null。

示例响应

{
  "url": "https://exercism.org/tracks/ruby/exercises/two-fer/solutions",
  "track": {
    "title": "Ruby",
    "iconUrl": "https://assets.exercism.org/tracks/ruby.svg"
  },
  "exercise": {
    "title": "Two Fer",
    "iconUrl": "https://assets.exercism.org/exercises/two-fer.svg"
  },
  "page": 1,
  "totalPages": 412,
  "totalCount": 9876,
  "solutionCount": 2,
  "solutions": [
    {
      "uuid": "b3f2c1a0-9d8e-4f7a-8c6b-1a2b3c4d5e6f",
      "author": {
        "handle": "neilnorthrop",
        "avatarUrl": "https://avatars.exercism.org/u/12345",
        "flair": "insider"
      },
      "language": "ruby",
      "numStars": 42,
      "numComments": 3,
      "numViews": 1280,
      "numIterations": 2,
      "numLoc": 3,
      "isOutOfDate": false,
      "publishedAt": "2026-05-18T14:03:27Z",
      "snippet": "def two_fer(name = \"you\")\n  \"One for #{name}, one for me.\"\nend",
      "url": "https://exercism.org/tracks/ruby/exercises/two-fer/solutions/neilnorthrop"
    },
    {
      "uuid": "c4e3d2b1-0a9f-4e8b-9d7c-2b3c4d5e6f70",
      "author": {
        "handle": "erikschierboom",
        "avatarUrl": "https://avatars.exercism.org/u/67890",
        "flair": null
      },
      "language": "ruby",
      "numStars": 17,
      "numComments": 0,
      "numViews": 640,
      "numIterations": 1,
      "numLoc": 4,
      "isOutOfDate": false,
      "publishedAt": "2026-04-02T09:11:50Z",
      "snippet": "def two_fer(name = \"you\")\n  format(\"One for %s, one for me.\", name)\nend",
      "url": "https://exercism.org/tracks/ruby/exercises/two-fer/solutions/erikschierboom"
    }
  ]
}