API Platformu
Google Görseller API
Google Görseller'de programatik olarak arama yapın.
Google Görseller'de programatik olarak arama yapın. Herhangi bir anahtar kelime, dil ve ülke için başlık, URL, kaynak sayfa ve ilgili aramalar içeren görsel sonuçları alın.
Ürün sayfası: Google Görseller API.
Kimlik Doğrulama
Tüm istekler başlık tabanlı kimlik doğrulama gerektirir. Her istekte API kimlik bilgilerinizi ekleyin.
| Header | Type | Açıklama |
|---|---|---|
SEMUST-API-USER | string | API kullanıcınızın kullanıcı adı |
SEMUST-API-PASSWORD | string | API kullanıcınızın şifresi |
API kimlik bilgilerini API Erişim sayfasında doğrulayabilirsiniz.
SEMUST-API-USER: your_username
SEMUST-API-PASSWORD: your_passwordRequest Parameters
Aşağıdaki parametrelerle bir application/json gövdesi gönderin:
Body
keywordstringrequiredGoogle Görseller için arama sorgusu (ör: "istanbul manzara", "modern mimari").
languagestringdefault: enDil kodu (ISO 639-1). Arama sonuçlarının dilini kontrol eder. Örnekler: "en", "tr", "de", "fr", "es".
countrystringdefault: USÜlke kodu (ISO 3166-1 alpha-2). Görsel sonuçlarını belirli bir ülkeye yönlendirir. Örnekler: "US", "TR", "DE", "GB".
depthintegerdefault: 100Döndürülecek görsel sonuç sayısı. Minimum: 1, Maksimum: 700. Varsayılan: 100. Yüksek değerler daha fazla sonuç döndürür ancak maliyeti artırabilir.
Derinlik Limiti
Depth parametresi 1 ile 700 arasında olmalıdır. Yüksek değerler daha fazla görsel döndürür ancak işlem süresini ve maliyeti artırır.
{
"keyword": "istanbul manzara",
"language": "tr",
"country": "TR",
"depth": 10
}Kod Örnekleri
Farklı programlama dillerinde Google Görseller API'yi nasıl kullanacağınızı gösteren örnekler.
curl -X POST https://data.semust.com/v1/google-images \
-H "Content-Type: application/json" \
-H "SEMUST-API-USER: your_username" \
-H "SEMUST-API-PASSWORD: your_password" \
-d '{
"keyword": "istanbul manzara",
"language": "tr",
"country": "TR",
"depth": 10
}'import requests
response = requests.post(
"https://data.semust.com/v1/google-images",
headers={
"SEMUST-API-USER": "your_username",
"SEMUST-API-PASSWORD": "your_password",
},
json={
"keyword": "istanbul manzara",
"language": "tr",
"country": "TR",
"depth": 10,
},
)
if response.status_code == 200:
data = response.json()
print(f"Found {data['result_count']} images")
for img in data.get("images", []):
print(f"{img['position']}. {img['title']}")
print(f" URL: {img['url']}")
print(f" Source: {img['source_url']}")
else:
print(f"Error [{response.status_code}]: {response.text}")const response = await fetch("https://data.semust.com/v1/google-images", {
method: "POST",
headers: {
"Content-Type": "application/json",
"SEMUST-API-USER": "your_username",
"SEMUST-API-PASSWORD": "your_password",
},
body: JSON.stringify({
keyword: "istanbul manzara",
language: "tr",
country: "TR",
depth: 10,
}),
});
if (response.ok) {
const data = await response.json();
console.log(`Found ${data.result_count} images`);
data.images?.forEach((img) => {
console.log(`${img.position}. ${img.title}`);
console.log(` URL: ${img.url}`);
console.log(` Source: ${img.source_url}`);
});
} else {
const text = await response.text();
console.error(`Error [${response.status}]: ${text}`);
}package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"keyword": "istanbul manzara",
"language": "tr",
"country": "TR",
"depth": 10,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST",
"https://data.semust.com/v1/google-images",
bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("SEMUST-API-USER", "your_username")
req.Header.Set("SEMUST-API-PASSWORD", "your_password")
resp, err := (&http.Client{}).Do(req)
if err != nil {
fmt.Printf("Request failed: %v\n", err)
return
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 {
var data map[string]interface{}
json.Unmarshal(respBody, &data)
if images, ok := data["images"].([]interface{}); ok {
for _, item := range images {
img := item.(map[string]interface{})
fmt.Printf("%v. %v\n", img["position"], img["title"])
fmt.Printf(" URL: %v\n", img["url"])
fmt.Printf(" Source: %v\n", img["source_url"])
}
}
} else {
fmt.Printf("Error %d: %s\n",
resp.StatusCode, string(respBody))
}
}<?php
$payload = json_encode([
"keyword" => "istanbul manzara",
"language" => "tr",
"country" => "TR",
"depth" => 10,
]);
$ch = curl_init("https://data.semust.com/v1/google-images");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"SEMUST-API-USER: your_username",
"SEMUST-API-PASSWORD: your_password",
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$data = json_decode($response, true);
echo "Found " . $data["result_count"] . " images\n";
foreach ($data["images"] ?? [] as $img) {
echo $img["position"] . ". " . $img["title"] . "\n";
echo " URL: " . $img["url"] . "\n";
echo " Source: " . $img["source_url"] . "\n";
}
} else {
echo "Error [{$httpCode}]: {$response}\n";
}Response
Görsel sonuçları ve ilgili arama önerilerini içeren bir JSON nesnesi döndürür.
Yanıt Alanları
| Alan | Type | Açıklama |
|---|---|---|
success | boolean | Başarılı yanıtta her zaman true |
result_count | integer | Döndürülen görsel sayısı |
keyword | string | Kullanılan arama anahtar kelimesi |
country | string | Arama için kullanılan ülke |
language | string | Arama için kullanılan dil |
images | array | Görsel sonuç nesneleri dizisi |
related_searches | array | İlgili arama önerileri (boş olabilir) |
Görsel Nesne Alanları
| Alan | Type | Açıklama |
|---|---|---|
position | integer | Görselin sonuçlardaki sırası (1'den başlar) |
title | string | Görselin başlığı veya adı |
subtitle | string | Ek alt başlık veya açıklama |
alt | string | Görselin alt metni |
url | string | Görsel dosyasının doğrudan URL'si |
source_url | string | Görseli içeren web sayfasının URL'si |
İlgili Arama Alanları
| Alan | Type | Açıklama |
|---|---|---|
title | string | Önerilen ilgili arama terimi |
url | string | İlgili arama URL'si (boş olabilir) |
{
"success": true,
"result_count": 10,
"keyword": "istanbul manzara",
"country": "TR",
"language": "tr",
"images": [
{
"position": 1,
"title": "İstanbul Boğazı Manzarası",
"subtitle": "Galata Kulesi'nden çekilmiş",
"alt": "Istanbul Bosphorus view at sunset",
"url": "https://example.com/images/istanbul-bosphorus.jpg",
"source_url": "https://example.com/istanbul-photos"
},
{
"position": 2,
"title": "İstanbul Silueti",
"subtitle": "",
"alt": "Istanbul skyline panorama",
"url": "https://example.com/images/istanbul-skyline.jpg",
"source_url": "https://example.com/travel-gallery"
}
],
"related_searches": [
{
"title": "istanbul gece manzarası",
"url": ""
},
{
"title": "istanbul boğaz manzarası",
"url": ""
}
]
}Hata Kodları
Tüm hatalar, insan tarafından okunabilir bir mesaj ve bir hata kodu içeren bir JSON nesnesi döndürür.
| HTTP | Kod | Anlamı |
|---|---|---|
| 400 | INVALID_REQUEST | İstek gövdesi hatalı biçimlendirilmiş veya gerekli alanlar eksik |
| 400 | KEYWORD_REQUIRED | Anahtar kelime alanı boş veya eksik |
| 401 | INVALID_API_KEY | Kimlik doğrulama başarısız — geçersiz kullanıcı adı veya şifre |
| 402 | INSUFFICIENT_CREDITS | Hesabınızda yeterli kredi yok |
| 200 | EMPTY_RESULTS | Bu sorgu için görsel sonuç bulunamadı |
| 500 | INTERNAL_ERROR | Bir iç sunucu hatası oluştu |
| 502 | WORKER_FAILED | Worker'dan Google Görseller sonuçları alınamadı |
| 504 | TIMEOUT | İstek zaman aşımına uğradı (maks 10 dakika) |
{
"error": "Your account does not have enough credits",
"code": "INSUFFICIENT_CREDITS"
}Krediler & Rate Limits
Krediler
Her istek, depth parametresine bağlı olarak bakiyenizden kredi tüketir. Bakiyeniz yetersizse API HTTP 402 döndürür. Başarısız istekler otomatik olarak iade edilir.
Rate Limits
İstekler, planınıza göre dakika başına ve gün başına sınırlara tabidir. Sınırların aşılması HTTP 429 döndürür.
Önbellekleme
Yanıtlar 24 saat boyunca önbelleğe alınır. Aynı anahtar kelime, dil, ülke ve depth ile yapılan tekrar istekler, ek kredi maliyeti olmadan önbellekten sunulur.
