Baidu Image Search
curl --request GET \
--url https://scrapebadger.com/v1/baidu/images \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://scrapebadger.com/v1/baidu/images"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://scrapebadger.com/v1/baidu/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://scrapebadger.com/v1/baidu/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://scrapebadger.com/v1/baidu/images"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://scrapebadger.com/v1/baidu/images")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://scrapebadger.com/v1/baidu/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"query": "<string>",
"page": 123,
"total_results": 123,
"results": [
{
"position": 123,
"title": "<string>",
"image_url": "<string>",
"thumbnail_url": "<string>",
"middle_url": "<string>",
"hover_url": "<string>",
"width": 123,
"height": 123,
"type": "<string>",
"from_url": "<string>",
"from_title": "<string>"
}
]
}Search
Baidu Image Search
Search Baidu images — full-size image URLs, Baidu-hosted thumbnail copies, pixel dimensions, format and the source page each image came from.
GET
/
v1
/
baidu
/
images
Baidu Image Search
curl --request GET \
--url https://scrapebadger.com/v1/baidu/images \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://scrapebadger.com/v1/baidu/images"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://scrapebadger.com/v1/baidu/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://scrapebadger.com/v1/baidu/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://scrapebadger.com/v1/baidu/images"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://scrapebadger.com/v1/baidu/images")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://scrapebadger.com/v1/baidu/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"query": "<string>",
"page": 123,
"total_results": 123,
"results": [
{
"position": 123,
"title": "<string>",
"image_url": "<string>",
"thumbnail_url": "<string>",
"middle_url": "<string>",
"hover_url": "<string>",
"width": 123,
"height": 123,
"type": "<string>",
"from_url": "<string>",
"from_title": "<string>"
}
]
}Search Baidu images. Each result carries the full-size image URL (Baidu’s
decoded
objURL), three Baidu-hosted copies at different sizes, the real pixel
dimensions, the file format, and the page the image was found on.
Credits: 5
Authorization
Query Parameters
Result page,
1–50. Fixed at 30 images per page — Baidu’s own page size,
not adjustable.Response
Images on this page (up to 30).
Show ImageResult
Show ImageResult
Only
position, query and page are guaranteed present — including title,
which Baidu omits on some tiles. Every other field is nullable.Example
curl "https://scrapebadger.com/v1/baidu/images?query=%E7%8C%AB" \
-H "X-API-Key: YOUR_API_KEY"
const res = await fetch(
"https://scrapebadger.com/v1/baidu/images?" + new URLSearchParams({ query: "猫" }),
{ headers: { "X-API-Key": process.env.SCRAPEBADGER_API_KEY } },
);
const data = await res.json();
import requests
res = requests.get(
"https://scrapebadger.com/v1/baidu/images",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"query": "猫"},
)
data = res.json()
Response
{
"query": "猫",
"page": 1,
"total_results": 748836,
"results": [
{
"position": 1,
"title": "白杯,咖啡,咖啡豆 4k",
"image_url": "https://s2.best-wallpaper.net/wallpaper/iphone/1708/White-cup-coffee-coffee-beans_iphone_640x1136.jpg",
"thumbnail_url": "https://img0.baidu.com/it/u=1467163901,1497482106&fm=253&fmt=auto&app=138&f=JPEG?w=282&h=500",
"middle_url": "https://img0.baidu.com/it/u=1467163901,1497482106&fm=253&fmt=auto&app=138&f=JPEG?w=282&h=500",
"hover_url": "https://img0.baidu.com/it/u=1467163901,1497482106&fm=253&fmt=auto&app=138&f=JPEG?w=282&h=500",
"width": 640,
"height": 1136,
"type": "jpg",
"from_url": "http://cn.best-wallpaper.net/white-cup-coffee-coffee-beans_wallpapers.html",
"from_title": "白杯,咖啡,咖啡豆 4k"
},
{
"position": 2,
"title": "时光里的咖啡记忆 #咖啡 #拿铁 - 抖音",
"image_url": "https://p3-pc-sign.douyinpic.com/tos-cn-i-0813c000-ce/oIf4pFOAEQFIwUojvFf8aAUA9ACTnDezEAqxEq~tplv-dy-aweme-images:q75.webp",
"thumbnail_url": "https://img2.baidu.com/it/u=2072998656,274351222&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1067",
"middle_url": "https://img2.baidu.com/it/u=2072998656,274351222&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1067",
"hover_url": "https://img2.baidu.com/it/u=2072998656,274351222&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1067",
"width": 1080,
"height": 1440,
"type": "jpg",
"from_url": "http://www.douyin.com/note/7467811736117087545",
"from_title": "时光里的咖啡记忆 #咖啡 #拿铁 - 抖音"
}
]
}
Which URL to use
| Field | Host | Use it for |
|---|---|---|
image_url | The origin site | Downloading the real asset at full resolution. |
thumbnail_url / middle_url / hover_url | img*.baidu.com | Grids and previews — Baidu’s CDN is fast and does not hotlink-block. |
image_url points at a third-party host, so it can 404, hotlink-block, or
redirect — Baidu’s index outlives the pages it indexed. Fall back to
thumbnail_url when a fetch of image_url fails, and treat width/height
as describing the original asset, not the Baidu-hosted copies.type is Baidu’s declared format and is frequently jpg even for a .webp
asset. Sniff the bytes if the real format matters.Errors
| Status | Meaning |
|---|---|
422 | Anti-bot challenge — not billed. Retry; it succeeds. |
502 | Baidu’s image JSON API returned an unparseable payload. Retry. |

