Войти

Использование API

Добавьте &scraper=github-profile к запросу Crawling API. 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
Логин аккаунта (слаг профиля).
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": []
}