Exercism Exercise
Parse a single Exercism exercise overview page into structured JSON with its title, difficulty, and full instructions as text and HTML.
API usage
Add &scraper=exercism-exercise to a Crawling API request. URL-encode the target URL in the url parameter.
curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
--data-urlencode 'url=https://exercism.org/tracks/ruby/exercises/two-fer' \
--data-urlencode 'scraper=exercism-exercise' -Gfrom crawlbase import CrawlingAPI
api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
'https://exercism.org/tracks/ruby/exercises/two-fer',
{'scraper': 'exercism-exercise'}
)
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',
{ scraper: 'exercism-exercise' }
);
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', scraper: 'exercism-exercise')
data = JSON.parse(res.body)Example input URL
Any Exercism exercise overview page works in the url parameter - the page at /tracks/<track>/exercises/<slug>. For example:
https://exercism.org/tracks/ruby/exercises/two-fer
https://exercism.org/tracks/python/exercises/leap
https://exercism.org/tracks/go/exercises/hello-world
https://exercism.org/tracks/rust/exercises/grainsResponse shape
JSON response body. Field types may be null when the source page omits the value.
URL of the exercise page that was scraped.
Track slug read from the URL path (for example
ruby), or null when it cannot be determined.Exercise slug read from the URL path (for example
two-fer), or null when it cannot be determined.Exercise display title.
Difficulty label (for example
easy, medium, hard).Full exercise instructions as plain text, with whitespace collapsed.
Full exercise instructions as HTML, preserving headings, code blocks, and lists.
Sample response
{
"url": "https://exercism.org/tracks/ruby/exercises/two-fer",
"track": "ruby",
"slug": "two-fer",
"title": "Two Fer",
"difficulty": "easy",
"instructions": "Two Fer Two-fer is short for two for one. One for you and one for me. Given a name, return a string with the message: One for name, one for me. Where \"name\" is the given name. However, if the name is missing, return the string: One for you, one for me.",
"instructionsHtml": "Instructions
\nTwo-fer is short for two for one. One for you and one for me.
\nGiven a name, return a string with the message:
\nOne for name, one for me.
"
}