crawlbaseDocs
Log in
What the listing page does not expose

Kaggle labels the result total only as Results (100+), so totalCountLabel is returned verbatim as a string rather than converted to a number. Rows with more than one author render stacked avatars with no image URL in the document, so author.image is empty on those rows. A notebook attached to several competitions shows the first one plus a +2 badge - the extra names are not in the page, so only additionalContextCount can be reported.

API usage

Add &scraper=kaggle-notebook-serp 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://www.kaggle.com/code?searchQuery=titanic' \
  --data-urlencode 'scraper=kaggle-notebook-serp' -G
from crawlbase import CrawlingAPI

api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://www.kaggle.com/code?searchQuery=titanic',
    {'scraper': 'kaggle-notebook-serp'}
)

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

const res = await api.get(
  'https://www.kaggle.com/code?searchQuery=titanic',
  { scraper: 'kaggle-notebook-serp' }
);
const data = JSON.parse(res.body);
require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')

res = api.get('https://www.kaggle.com/code?searchQuery=titanic', scraper: 'kaggle-notebook-serp')
data = JSON.parse(res.body)

Example input URL

Any Kaggle notebook search or listing page works in the url parameter - the page at /code, with or without a query string. For example:

https://www.kaggle.com/code?searchQuery=titanic
https://www.kaggle.com/code?searchQuery=xgboost&language=Python
https://www.kaggle.com/code
https://www.kaggle.com/code?searchQuery=nlp&page=2

Response shape

JSON response body. Field types may be null when the source page omits the value.

url
string
URL of the search page that was scraped.
query
string | null
Search term read from the request URL. Kaggle leaves the rendered search box empty on this page, so the URL is the only source.
totalCountLabel
string | null
Result total exactly as Kaggle labels it, for example 100+. Returned as a string because the page does not state an exact number.
page
integer | null
Current page number, or null when it cannot be determined.
hasNextPage
boolean
Whether a further page of results is available.
resultCount
integer
Number of rows returned on this page.
results
array
Notebook rows in the order they appear on the page.
results[].position
integer
One-based rank of the row within this page.
results[].title
string | null
Notebook display title.
results[].url
string | null
Absolute URL of the notebook.
results[].slug
string | null
Notebook identifier as author/notebook, read from the URL path.
results[].author
object
Account that owns the notebook.
results[].author.username
string | null
Owner handle, taken from the first path segment of the notebook URL so it resolves on co-authored rows too.
results[].author.name
string | null
Owner display name.
results[].author.url
string | null
Absolute URL of the owner profile.
results[].author.image
string | null
Owner avatar URL. Empty on co-authored rows, where Kaggle renders stacked avatars with no URL in the document.
results[].coauthors
array
Display names of the additional authors, as an array of strings. Empty on single-author notebooks.
results[].lastUpdated
string | null
Absolute timestamp of the last notebook update. The card shows only a relative age, so the value is taken from the tooltip behind it and keeps Kaggle formatting rather than ISO 8601.
results[].commentCount
integer | null
Number of comments on the notebook.
results[].context
string | null
Name of the competition or dataset the notebook is attached to.
results[].additionalContextCount
integer
How many further competitions or datasets the notebook is attached to beyond context. Their names are not in the page, so only the count is available.
results[].votes
integer | null
Upvote count for the notebook.
results[].medal
string | null
Kaggle medal on the notebook (for example gold), or null when the row carries none.

Sample response

{
  "url": "https://www.kaggle.com/code?searchQuery=titanic",
  "query": "titanic",
  "totalCountLabel": "100+",
  "page": 1,
  "hasNextPage": true,
  "resultCount": 20,
  "results": [
    {
      "position": 1,
      "title": "Titanic Tutorial",
      "url": "https://www.kaggle.com/code/alexisbcook/titanic-tutorial",
      "slug": "alexisbcook/titanic-tutorial",
      "author": {
        "username": "alexisbcook",
        "name": "Alexis Cook",
        "url": "https://www.kaggle.com/alexisbcook",
        "image": "https://storage.googleapis.com/kaggle-avatars/thumbnails/2603295-kg.jpg"
      },
      "coauthors": [],
      "lastUpdated": "Fri Jun 24 2022 00:25:16 GMT+0000 (Coordinated Universal Time)",
      "commentCount": 30626,
      "context": "Titanic - Machine Learning from Disaster",
      "additionalContextCount": 0,
      "votes": 60135,
      "medal": "gold"
    },
    {
      "position": 3,
      "title": "Spaceship Titanic with TFDF",
      "url": "https://www.kaggle.com/code/gusthema/spaceship-titanic-with-tfdf",
      "slug": "gusthema/spaceship-titanic-with-tfdf",
      "author": {
        "username": "gusthema",
        "name": "Gusthema",
        "url": "https://www.kaggle.com/gusthema",
        "image": ""
      },
      "coauthors": [
        "Nidhin PD"
      ],
      "lastUpdated": "Mon Apr 17 2023 09:36:29 GMT+0000 (Coordinated Universal Time)",
      "commentCount": 378,
      "context": "Spaceship Titanic",
      "additionalContextCount": 0,
      "votes": 7863,
      "medal": "gold"
    },
    {
      "position": 10,
      "title": "Titanic Top Solution",
      "url": "https://www.kaggle.com/code/brendan45774/titanic-top-solution",
      "slug": "brendan45774/titanic-top-solution",
      "author": {
        "username": "brendan45774",
        "name": "Brenda N",
        "url": "https://www.kaggle.com/brendan45774",
        "image": "https://storage.googleapis.com/kaggle-avatars/thumbnails/2681031-kg.jpg"
      },
      "coauthors": [],
      "lastUpdated": "Wed Sep 01 2021 16:03:11 GMT+0000 (Coordinated Universal Time)",
      "commentCount": 249,
      "context": "Titanic - Machine Learning from Disaster",
      "additionalContextCount": 2,
      "votes": 2294,
      "medal": "gold"
    }
  ]
}