优酷 API - 视频搜索 (V1)
该API基于关键词在优酷平台执行搜索,返回与搜索词匹配的视频列表。 返回字段包括视频ID、标题、封面图片、时长、播放量、发布时间以及视频详情页URL。
典型应用场景:
- 基于关键词的视频发现。
- 监控优酷平台上的特定话题或趋势。
- 为市场研究分析搜索结果。
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | TOKEN |
keyword | query | string | 是 | 用于搜索的关键词。 |
page | query | integer | 否 | 用于分页的页码,从1开始。 |
代码示例
💡 环境说明
默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择。
bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE"text
我想使用 Just One API 提供的“视频搜索 (V1)”接口。
接口地址: https://api.justoneapi.com/api/youku/search-video/v1
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/youku-apis/video-search-v1-zh.json
请求参数说明:
- token (query): TOKEN (必填)
- keyword (query): 用于搜索的关键词。 (必填)
- page (query): 用于分页的页码,从1开始。
返回格式: JSON
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 余额不足
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url)
print(response.json())js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/youku/search-video/v1?token=YOUR_API_KEY&keyword=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;响应结果
json
{
"code": 0,
"data": {
"api": "mtop.youku.soku.yksearch",
"data": {
"nodes": [
{
"nodes": [
{
"nodes": [
{
"data": {
"sourceId": 14,
"hasYouku": 1,
"realShowId": "fddb67906b9b41508191",
"docId": "743654",
"episodeTotal": 6,
"episodeCollect": 6,
"featureDTO": {
"text": "纪录片 · 2025 · 中国"
},
"ugcSupply": 0,
"episodeType": 1,
"itemLog": "eps_t~1$site~14$show_id~fddb67906b9b41508191$doc_source~1$eng_source~6$sp_id~1156115474216386560$doc...",
"showId": "fddb67906b9b41508191",
"exclusive": 0,
"action": {
"report": {
"trackInfo": {
"object_url": "youku://play?source=search&showid=fddb67906b9b41508191&politicsSensitive=false&searchKey=deepseek",
"object_type": 101,
"group_id": "fddb67906b9b41508191",
"group_num": 1,
"recommend_source": "热度",
"object_title": "DeepSeek 快速入门指南",
"group_type": 1,
"recommend_title": "热度 181",
"source_id": 14,
"item_log": "eps_t~1$site~14$show_id~fddb67906b9b41508191$doc_source~1$eng_source~6$sp_id~1156115474216386560$doc...",
"cid": 1156115474216386600
}
},
"type": "JUMP_TO_NATIVE",
"value": "youku://play?source=search&showid=fddb67906b9b41508191&politicsSensitive=false&searchKey=deepseek"
},
"needLess": false,
"thumbUrl": "https://m.ykimg.com/050C000067BFD3B91FDCE4125A00EEC9",
"rightButtonDTO": {
"isDownload": false,
"buttonType": 4,
"displayName": "详情",
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuProgram_1.skipdetail",
"trackInfo": {
"object_url": "youku://soku/dataDetail?showId=fddb67906b9b41508191&title=DeepSeek 快速入门指南&vThumbUrl=http%3A%2F%2Fr1....",
"object_type": 3,
"group_id": "fddb67906b9b41508191",
"group_num": 1,
"object_title": "详情",
"isplay": 3,
"group_type": 1,
"object_id": "fddb67906b9b41508191"
},
"arg1": "skipdetail_of_PhoneSokuProgram",
"scm": "20140669.search.rdoc.show_fddb67906b9b41508191"
},
"type": "JUMP_TO_NATIVE",
"value": "youku://soku/dataDetail?showId=fddb67906b9b41508191&title=DeepSeek 快速入门指南&vThumbUrl=http%3A%2F%2Fr1...."
}
},
"info": "简介:还在为不会使用Deepseek而烦恼?这门《DeepSeek 快速入门指南》课程就是你的救星!本课程共6集,从基础概念出发,带你了解Deepseek是什么、能做什么,深入通用版的入门操作、模式选...",
"leftButtonDTO": {
"buttonType": "0",
"displayName": "播放",
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuProgram_1.playbutton",
"trackInfo": {
"object_title": "播放"
},
"arg1": "playbutton_of_PhoneSokuProgram",
"scm": "20140669.search.rdoc.show_fddb67906b9b41508191"
},
"type": "JUMP_TO_NATIVE",
"value": "youku://play?source=search&showid=fddb67906b9b41508191&politicsSensitive=false&searchKey=deepseek"
}
},
"coupon": {
"playRules": 0,
"action_type": "JUMP_TO_URL",
"link": "https://t.youku.com/app/visp/cashier_4/index?en_sid=743654&h5params=%7B%22pageKey%22%3A%22NEWSTANDAR...",
"title": "开通会员,畅享精彩内容",
"out_task_id": 22393,
"delivery_white_list_flag": "false",
"highlight": 0,
"cashier_attributes": "{\"hitRules\":\"{\\\"LINK_PARAM\\\":\\\"12,14,152\\\",\\\"LINK_PATH\\\":\\\"50\\\",\\\"PAGE_KEY\\\":\\\"6\\\",\\\"SCENE_TYPE\\\":\\\"...",
"payType": "",
"cashierPageKey": "NEWSTANDARDRENDER_YOUKU",
"cashier_ab_test": "0",
"product_id": "128",
"activity_id": "35534",
"product_sku_id": "128_305",
"goods_rights_type": 3,
"render_status": 1,
"crm_params": "{\"cvid\":\"\",\"nvid\":\"\",\"cgid\":\"84\",\"touch_point_code\":\"pc_search_becomevip\",\"NEWSTANDARDRENDER_YOUKU\":...",
"scm": "20140732.0.0.crm_20140732-manual-999_7_0_0-102944_100611_0_1_22393_2325_1773064803646_8604835af9cf48...",
"link_style": 2,
"goods_id": "102944",
"sku_id": "305",
"userMaterialType": 1,
"activity_code": "n_crm_lxbys3y9.9",
"crm_d": "20140732-manual-999_7_0_0-102944_100611_0_1_22393_2325_1773064803646_8604835af9cf484c855f679341cd707...",
"one_day_upgrade": false,
"goods_type": 1
},
"logCate": "doc",
"recommendDTO": {
"recommendLeftIcon": "http://youku-search-console.youku.com/1588903977750",
"showType": 4,
"recommends": [
{
"displayName": "热度 181",
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuProgram_1.recommend_1",
"trackInfo": {
"object_type": 110,
"object_title": "DeepSeek 快速入门指南",
"group_type": 1,
"item_log": "eps_t~1$site~14$show_id~fddb67906b9b41508191$doc_source~1$eng_source~6$sp_id~1156115474216386560$doc...",
"object_num": 1
},
"arg1": "recommend_of_PhoneSokuProgram",
"scm": "20140669.search.rdoc.url"
},
"type": "JUMP_TO_NATIVE"
}
}
]
},
"stripeBottom": "6期全",
"posterDTO": {
"iconCorner": {
"tagType": 3,
"tagText": "付费"
},
"vThumbUrl": "http://m.ykimg.com/0526000067BFD67220039610817E0D82",
"posterType": "showW3H4ThumbUrl",
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuProgram_1.poster",
"arg1": "poster_of_PhoneSokuProgram",
"scm": "20140669.search.rdoc.show_fddb67906b9b41508191"
},
"type": "JUMP_TO_NATIVE",
"value": "youku://play?source=search&showid=fddb67906b9b41508191&politicsSensitive=false&searchKey=deepseek"
}
},
"completed": 1,
"recommendDisplayType": "-2",
"titleDTO": {
"displayName": "DeepSeek 快速入门指南",
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuProgram_1.title",
"arg1": "title_of_PhoneSokuProgram",
"scm": "20140669.search.rdoc.show_fddb67906b9b41508191"
},
"type": "JUMP_TO_NATIVE",
"value": "youku://play?source=search&showid=fddb67906b9b41508191&politicsSensitive=false&searchKey=deepseek"
}
},
"disableClick": false,
"docSource": 1,
"cats": "纪录片",
"tempTitle": "DeepSeek 快速入门指南",
"animeEdition": 0,
"showMediaTag": [
{
"tagType": 3,
"tagText": "付费"
}
],
"cateId": 9,
"paid": 1,
"isYouku": 1,
"sourceName": "优酷",
"showIdValid": -1,
"moreButtonDTO": {
"action": {
"report": {
"spm": "a2h0c.8166622.PhoneSokuMore_1.more",
"trackInfo": {
"object_url": "youku://soku/series?title=DeepSeek 快速入门指南&showId=fddb67906b9b41508191&site=1&siteId=14&keyword=deeps...",
"object_type": 3,
"group_id": "fddb67906b9b41508191",
"group_num": 1,
"object_title": "查看更多",
"group_type": 1,
"item_log": "eps_t~1$site~14$show_id~fddb67906b9b41508191$doc_source~1$eng_source~6$sp_id~1156115474216386560$doc..."
},
"arg1": "more_of_PhoneSokuMore",
"scm": "20140669.search.rdoc.show_fddb67906b9b41508191"
},
"type": "JUMP_TO_NATIVE",
"value": "youku://soku/series?title=DeepSeek 快速入门指南&showId=fddb67906b9b41508191&site=1&siteId=14&keyword=deeps..."
},
"title": "更多"
},
"isTrailer": 0,
"programId": "743654",
"mediaCompleted": 1
},
"level": 3,
"more": false,
"style": [
{
"type": 0
}
],
"id": 0,
"type": 1027
}
],
"level": 2,
"more": false,
"style": [
{
"type": 0
}
],
"id": 0,
"type": 1027
}
],
"data": {
"schema": "1",
"version": 311,
"docSource": 1
},
"level": 1,
"more": false,
"style": [
{
"type": 0
}
],
"id": 0,
"type": 0
}
],
"data": {
"displaySearchTerms": "deepseek",
"pz": 30,
"rstate": 0,
"isEnd": 0,
"isModule": true,
"globalControlParam": {
"closeRetentionPop": true
},
"highlightWord": "deep,seek",
"filter": {
"duration": [
{
"title": "全部",
"value": "0-0"
}
],
"cate": [
{
"id": "0",
"title": "全部"
}
],
"newType": true,
"tab": [
{
"orders": [
{
"title": "综合排序",
"value": 0
}
],
"id": "0",
"title": "综合排序"
}
],
"format": [
{
"title": "全部",
"value": 0
}
]
},
"total": 322,
"typeVersion": "B",
"pg": 1,
"action": {
"report": {
"trackInfo": {
"searchtab": "0",
"source_from": "home",
"eid": "0bf85bff17730648034531522e2b80",
"search_from": "1",
"engine": "expid~req.ugc105.sort1004.rank105.qa0$eid~0bf85bff17730648034531522e2b80$bts~soku_engine_master#105$...",
"aaid": "9fbffd5aabe0f1eeaa005d2258486410",
"k": "deepseek"
},
"pageName": "page_searchresults"
}
},
"hitNFMode": true,
"status": "success"
},
"level": 0,
"more": true,
"id": 0,
"type": 0
},
"ret": [
"SUCCESS::调用成功"
],
"v": "2.0"
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
