登录

API 用法

Crawling API 请求中添加 &scraper=github-repository。在 url 参数中对目标 URL 进行 URL 编码。

curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://github.com/rails/rails' \
  --data-urlencode 'scraper=github-repository' -G
from crawlbase import CrawlingAPI

api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://github.com/rails/rails',
    {'scraper': 'github-repository'}
)

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/rails/rails',
  { scraper: 'github-repository' }
);
const data = JSON.parse(res.body);
require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')

res = api.get('https://github.com/rails/rails', scraper: 'github-repository')
data = JSON.parse(res.body)

示例输入 URL

传入 url 参数的 URL(为便于阅读已 URL 解码):

https://github.com/rails/rails

响应结构

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

name
string | null
仓库名称。
owner
string | null
所有者(用户或组织)登录名。
fullName
string
完整的 owner/name 标识符。
url
string
规范的仓库 URL。
description
string | null
仓库描述(页眉下方的标语)。
primaryLanguage
string | null
主要编程语言(languages 的第一项)。
languages
array
仓库语言栏中列出的语言。
stars
integer | null
Star 数量。
forks
integer | null
Fork 数量。
watchers
integer | null
Watcher 数量。
hasIssues
boolean
如果启用了 Issues 标签页则为 true。
openIssuesCount
integer | null
未关闭的 issue 数量。
openPrsCount
integer | null
未关闭的 pull request 数量。
topics
array
仓库主题标签。
license
string | null
侧边栏中显示的许可证名称。
defaultBranch
string | null
默认分支名称。
latestRelease
string | null
当仓库有发布版本时,最新的发布标签。
readmePresent
boolean
如果存在已渲染的 README 则为 true。
archived
boolean
如果仓库已归档(只读)则为 true。

示例响应

{
  "name": "rails",
  "owner": "rails",
  "fullName": "rails/rails",
  "url": "https://github.com/rails/rails",
  "description": "Ruby on Rails",
  "primaryLanguage": "Ruby",
  "languages": ["Ruby", "JavaScript", "HTML", "SCSS", "CSS", "Dockerfile"],
  "stars": 58789,
  "forks": 22414,
  "watchers": 2400,
  "hasIssues": true,
  "openIssuesCount": 478,
  "openPrsCount": 1081,
  "topics": ["ruby", "rails", "html", "activerecord", "framework", "mvc", "activejob"],
  "license": "MIT license",
  "defaultBranch": "main",
  "latestRelease": "v8.1.3",
  "readmePresent": true,
  "archived": false
}