此端点可以帮助您
响应包含匹配的搜索、公开上下文,以及在有更多结果时的分页数据。
何时使用
当不知道确切的对象 ID、需要先找到相关候选项时,请使用“按查询获取直播频道”。
先查看结果和常见工作流,然后再了解参数和可运行的请求示例。
响应包含匹配的搜索、公开上下文,以及在有更多结果时的分页数据。
当不知道确切的对象 ID、需要先找到相关候选项时,请使用“按查询获取直播频道”。
在面向客户的界面和内部界面中加入 Twitch 数据搜索。
按查询查找候选项,并保存相关对象以供后续补全。
收集结果集,用于主题、创作者和竞品分析。
两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。
在本页面切换版本,即可在同一文档 URL 下比较响应结构。
V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。
主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。
两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。
| 参数 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|
query |
是 | str |
gaming |
用户输入的搜索关键词。 |
cursor |
否 | str | None |
MTU= |
上一次响应返回的下一页游标。获取第一页时请省略。 |
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v2/twitch.tv/search/live-channels-by-querycurl --request GET \
--url "https://www.scrapestorm.net/api/v2/twitch.tv/search/live-channels-by-query" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'query=gaming' \
# Optional parameters:
# --data-urlencode 'cursor=MTU='
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/twitch.tv/search/live-channels-by-query"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"query": "gaming",
}
# Optional parameters
# params["cursor"] = "MTU="
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v2/twitch.tv/search/live-channels-by-query";
const params = new URLSearchParams({
query: "gaming",
});
// Optional parameters
// params.set("cursor", "MTU=");
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
query: "gaming",
};
// Optional parameters
// params.cursor = "MTU=";
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"query" => "gaming",
];
// Optional parameters
// $query["cursor"] = "MTU=";
try {
$response = $client->request("GET", "/api/v2/twitch.tv/search/live-channels-by-query", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v2/twitch.tv/search/live-channels-by-query"
params := url.Values{}
params.Set("query", "gaming")
// Optional parameters
// params.Set("cursor", "MTU=")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v1/twitch.tv/search/live-channels-by-querycurl --request GET \
--url "https://www.scrapestorm.net/api/v1/twitch.tv/search/live-channels-by-query" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'query=gaming' \
# Optional parameters:
# --data-urlencode 'cursor=MTU='
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v1/twitch.tv/search/live-channels-by-query"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"query": "gaming",
}
# Optional parameters
# params["cursor"] = "MTU="
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v1/twitch.tv/search/live-channels-by-query";
const params = new URLSearchParams({
query: "gaming",
});
// Optional parameters
// params.set("cursor", "MTU=");
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
query: "gaming",
};
// Optional parameters
// params.cursor = "MTU=";
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"query" => "gaming",
];
// Optional parameters
// $query["cursor"] = "MTU=";
try {
$response = $client->request("GET", "/api/v1/twitch.tv/search/live-channels-by-query", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v1/twitch.tv/search/live-channels-by-query"
params := url.Values{}
params.Set("query", "gaming")
// Optional parameters
// params.Set("cursor", "MTU=")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
预览保留了关键字段和集合中的前几项,便于您快速浏览响应结构。切换版本会改变 JSON 格式。
此简明 JSON 示例来自 V2 最近一次成功的验证运行。
{
"success": true,
"status": "ok",
"pagination": {
"cursor": "QVFB...",
"has_more": true
},
"search_context": {
"query": "gaming"
},
"data": {
"live_channels": {
"count": 15,
"items": [
{
"rank": 1,
"channel_url": "https://www.twitch.tv/zentreya",
"user_id": "128440061",
"username": "zentreya",
"display_name": "Zentreya",
"description": "【 VARIETY STREAMER VTUBER 】 【⚡ THE CYBER PUNK / ROCKIN RED DRAGON 🔥 】. I have an amazing community, stop by, say hi! Hope you enjoy watching and have fun! ( BUSINESS INQUIRES :…",
"hashtags": [],
"emails": [
"[email protected]",
"[email protected]"
],
"is_partner": true,
"is_live": true,
"follower_count": 612568,
"stream": {
"stream_id": "320448797530",
"type": "live",
"title": "NEW 3D UPDATES AND A COOL NEW OUTFIT + COLLAB DAY + NEW ZEN FIGURE DROP !ggd | !agentink !youtooz !nendo !spencers !senpai !v1tech !vite",
"game": {
"game_id": "789588840",
"slug": "funnel-runners",
"name": "Funnel Runners",
"display_name": "Funnel Runners"
},
"started_at": "2026-07-19T15:58:37.516727Z",
"viewer_count": 4914,
"preview_image_url": "https://example.com/image.jpg",
"vertical_preview_image_url": "https://example.com/image.jpg",
"template_preview_image_url": "https://example.com/image.jpg",
"width": 1920,
"height": 1080,
"tags": [
"English",
"ForkliftCertified",
{
"_more_items": 8
}
]
},
"latest_video": {
"video_id": "2823900103",
"title": "NEW 3D UPDATES AND A COOL NEW OUTFIT + COLLAB DAY + NEW ZEN FIGURE DROP !ggd | !agentink !youtooz !nendo !spencers !senpai !v1tech !vite",
"video_url": "https://www.twitch.tv/videos/2823900103",
"preview_thumbnail_url": "https://example.com/image.jpg",
"duration_seconds": 20040
},
"top_clip": {
"clip_id": "1186678872",
"slug": "RealHelpfulDeerNotLikeThis-gZwKslfacDFqbqep",
"title": "didyouseeit!",
"clip_url": "https://clips.twitch.tv/RealHelpfulDeerNotLikeThis-gZwKslfacDFqbqep",
"preview_thumbnail_url": "https://example.com/image.jpg",
"duration_seconds": 59
},
"avatar_url": "https://example.com/image.jpg"
},
{
"rank": 2,
"channel_url": "https://www.twitch.tv/controcalcio__",
"user_id": "541899730",
"username": "controcalcio__",
"display_name": "ControCalcio__",
"description": "Il Canale Twitch di Controcalcio! Tutti i giorni live dalle 16!",
"hashtags": [],
"emails": [],
"is_partner": true,
"is_live": true,
"follower_count": 144445,
"stream": {
"stream_id": "320561303771",
"type": "live",
"title": "REACTION INGHILTERRA FRANCIA! ATTENTION PLEASE! MBAPPE CAPOCANNONIERE? TANTE NOTIZIE DI MERCADU",
"game": {
"game_id": "518203",
"slug": "sports-1",
"name": "Sports",
"display_name": "Sports"
},
"started_at": "2026-07-19T17:30:34.719Z",
"viewer_count": 2762,
"preview_image_url": "https://example.com/image.jpg",
"vertical_preview_image_url": "https://example.com/image.jpg",
"template_preview_image_url": "https://example.com/image.jpg",
"width": 1920,
"height": 1080,
"tags": [
"Italiano",
"gaming",
{
"_more_items": 1
}
]
},
"latest_video": {
"video_id": "2823962078",
"title": "REACTION INGHILTERRA FRANCIA! ATTENTION PLEASE! MBAPPE CAPOCANNONIERE? TANTE NOTIZIE DI MERCADU",
"video_url": "https://www.twitch.tv/videos/2823962078",
"preview_thumbnail_url": "https://example.com/image.jpg",
"duration_seconds": 14523
},
"top_clip": {
"clip_id": "52102576",
"slug": "CorrectCourageousKoalaHeyGirl-lUz_1Inf513UJRP4",
"title": "Chirico sale in cattedra",
"clip_url": "https://clips.twitch.tv/CorrectCourageousKoalaHeyGirl-lUz_1Inf513UJRP4",
"preview_thumbnail_url": "https://example.com/image.jpg",
"duration_seconds": 30
},
"avatar_url": "https://example.com/image.jpg"
},
{
"_more_items": 13
}
]
}
}
}
此简明 JSON 示例来自 V1 最近一次成功的验证运行。
{
"success": true,
"status": "ok",
"pagination": {
"cursor": "QVFB...",
"has_more": true
},
"search_context": {
"query": "gaming"
},
"data": {
"data": {
"searchFor": {
"banners": null,
"querySubstitution": {
"edges": [],
"__typename": "SearchForResultSubstitution"
},
"channels": {
"cursor": "",
"edges": [],
"score": 0,
"totalMatches": 0,
"__typename": "SearchForResultUsers"
},
"channelsWithTag": {
"cursor": "QVFB...",
"edges": [
{
"trackingID": "a973ce02-2fff-41b1-94b5-0e479c35c5de",
"item": "…",
"__typename": "SearchForEdge"
},
{
"trackingID": "76d25532-952e-4a1d-86ca-1930ad7a5d17",
"item": "…",
"__typename": "SearchForEdge"
},
{
"_more_items": 13
}
],
"score": 0,
"totalMatches": 15,
"__typename": "SearchForResultUsers"
},
"games": {
"cursor": "",
"edges": [],
"score": 0,
"totalMatches": 0,
"__typename": "SearchForResultGames"
},
"videos": {
"cursor": "",
"edges": [],
"score": 0,
"totalMatches": 0,
"__typename": "SearchForResultVideos"
},
"relatedLiveChannels": {
"edges": [],
"score": null,
"__typename": "SearchForResultRelatedLiveChannels"
},
"collections": {
"cursor": "",
"edges": [],
"score": 0,
"totalMatches": 0,
"__typename": "SearchForResultCollections"
},
"__typename": "SearchFor"
}
},
"extensions": {
"durationMilliseconds": 136,
"operationName": "SearchResultsPage_SearchResults",
"requestID": "01KXY4PY60MNX0KZ0FK36H97D2"
}
}
}
将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。
借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。
该方法针对搜索执行“按查询获取直播频道”操作。下方的简明响应示例展示了确切的字段结构。
新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。
创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。