Video search (/videos)

Reference for /videos: video search parameters, response fields, code in 5 languages, GET and POST forms, and a sample response.

Updated View as Markdown

The Google Videos tab, with duration, channel and platform. Results are in videos. The product page is Google Videos API.

Try in PlaygroundOpens the dashboard playground with this request filled in (sign in first).

Request

POST https://api.bestserp.com/videos with a JSON body, or GET https://api.bestserp.com/videos with the same parameters in the query string. The key goes in the X-API-KEY header either way (authentication).

POST
curl -X POST 'https://api.bestserp.com/videos' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"q":"python asyncio tutorial"}'
GET
curl -G 'https://api.bestserp.com/videos' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  --data-urlencode 'q=python asyncio tutorial'

Parameters

Unknown parameters are refused (unknown_parameter), so a typo never goes unnoticed.

ParameterTypeDefaultDescription
qrequiredstringSearch query (1–256 characters).
glstringusCountry, 2-letter code (us, gb, vn, de…). The search runs from an IP in that country when one is free, else from another one (see ipCountry).
hlstringenInterface language (en, vi, de…).
numinteger10Maximum results per page: 10, 20, 30, 40 or 50 (Google may return fewer, e.g. 8 or 9 of 10). Each 10 costs 1 credit.
pageinteger1Page to return, 1–5 (page × num/10 ≤ 5). Pages 1…page are fetched and charged.
tbsstringRecency: qdr:h (hour), qdr:d (day), qdr:w (week), qdr:m (month), qdr:y (year). Also accepted: timeRange = hour|day|week|month|year.
includeThumbnailsbooleanfalseInclude inline base64 thumbnails (~20 KB each).
noCachebooleanfalseSkip the 1-hour result cache (5 minutes for news).
asyncbooleanfalseAnswer 202 immediately with a requestId to poll.
timeoutnumber60Seconds to wait before answering 202 (1–120).
autocorrectbooleanAccepted for compatibility; no effect.

Response fields

Empty fields are left out of each item.

videos[]

FieldMeaning
positionRank of the video, from 1.
titleVideo title.
linkVideo page URL.
snippetDescription shown under the title, when there is one.
durationLength as displayed, e.g. 12:41.
channelChannel or uploader.
platformSite hosting the video, e.g. YouTube.
dateUpload date as displayed.
imageUrlThumbnail as an inline data: URI, only with includeThumbnails: true (about 20 KB each).

Every response

FieldMeaning
searchParametersYour request after validation, with defaults filled in (q, gl, hl, type, page or pages...).
requestIdID of this request. Poll GET /requests/{requestId} for async requests and for final links.
creditsCredits charged for this request (refunded automatically if it fails).
cachedtrue when the answer came from the recent-result cache (1 hour, 5 minutes for news).
linksPendingtrue while Google redirect links are being replaced by final URLs; poll the request to get them.
unresolvedLinksLinks that are still Google redirects: they work, but are not the final URL.
durationMsTime the search took, in milliseconds.
ipCountryCountry of the IP the search ran from (same code as gl). Another country than gl when no IP there was free: the search runs anyway instead of waiting. Missing when unknown.

Sample response

200 OK
{
  "searchParameters": {
    "q": "python asyncio tutorial",
    "gl": "us",
    "hl": "en",
    "type": "videos",
    "num": 10,
    "page": 1,
    "engine": "google"
  },
  "videos": [
    {
      "position": 1,
      "title": "Python asyncio in 20 minutes",
      "link": "https://www.youtube.com/watch?v=asyncio20m",
      "snippet": "Event loops, tasks and gather, explained with examples.",
      "duration": "20:14",
      "channel": "Code Simply",
      "platform": "YouTube",
      "date": "3 weeks ago"
    },
    {
      "position": 2,
      "title": "Async Python: the complete guide",
      "link": "https://www.youtube.com/watch?v=asyncguide",
      "snippet": "From coroutines to structured concurrency.",
      "duration": "1:02:45",
      "channel": "Dev Academy",
      "platform": "YouTube",
      "date": "2 months ago"
    },
    {
      "position": 3,
      "title": "asyncio vs threads: which is faster?",
      "link": "https://www.youtube.com/watch?v=asyncvsthr",
      "snippet": "We benchmark both on I/O-bound workloads.",
      "duration": "12:08",
      "channel": "Bench Bytes",
      "platform": "YouTube",
      "date": "5 days ago"
    }
  ],
  "requestId": "5b0c8a52-3f0e-4d55-9a2a-0f3a8e2d1c11",
  "credits": 1,
  "cached": false,
  "linksPending": false,
  "unresolvedLinks": 0,
  "durationMs": 1710
}

Limits

  • Duration, channel and date are strings as Google displays them; no view counts.
  • Video thumbnails are returned only with includeThumbnails: true.
  • Up to 5 pages per request (page x num/10 <= 5); each page costs 1 credit.
  • Targeting is by country (gl) and interface language (hl). City-level location is not supported yet: a request with location is refused with an explicit error.
  • Results are what a desktop browser sees. There is no mobile SERP option yet.
  • 60 searches per minute per account by default; ask on Telegram for more.

Errors and their credit rules are on the errors page.