General Search
Search YouTube by keyword with optional type, upload-date, duration, feature, and sort filters, or continue with a token. Use it to discover videos, channels, playlists, or movies.
Parameters
| Name | Required | Type | Description | Example | Allowed values |
|---|---|---|---|---|---|
keyword |
Optional | string | Search keyword. Required on the first request; leave empty when using a continuation token. | 咖啡 |
— |
continuation_token |
Optional | string | Pagination token returned by the previous response. | — | — |
upload_date |
Optional | string | Filter results by upload date. Available Values: - `last_hour`: Uploaded within the last hour - `today`: Uploaded today - `this_week`: Uploaded this week - `this_month`: Uploaded this month - `this_year`: Uploaded this year | last_hour |
last_hourtodaythis_weekthis_monththis_year |
type |
Optional | string | Filter results by result type. Available Values: - `video`: Video results - `channel`: Channel results - `playlist`: Playlist results - `movie`: Movie results | video |
videochannelplaylistmovie |
duration |
Optional | string | Filter video results by duration. Supported request values: short, medium, long. Available Values: - `SHORT`: Short videos under 4 minutes - `MEDIUM`: Medium videos from 4 to 20 minutes - `LONG`: Long videos over 20 minutes | SHORT |
SHORTMEDIUMLONG |
features |
Optional | string | Feature filters separated by commas. Supported values: live, 4k, hd, subtitles, creative_commons, 360, vr180, 3d, hdr. | live |
liveFOUR_Khdsubtitlescreative_commonsTHREE_SIXTYvr180THREE_Dhdr |
sort_by |
Optional | string | Sort order for search results. Available Values: - `relevance`: Sort by relevance - `upload_date`: Sort by upload date - `view_count`: Sort by view count - `rating`: Sort by rating | relevance |
relevanceupload_dateview_countrating |
Code samples
curl -G "https://api.mofa-ai.com/v1/youtube/search_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'keyword=咖啡' \
--data-urlencode 'upload_date=last_hour' \
--data-urlencode 'type=video' \
--data-urlencode 'duration=SHORT' \
--data-urlencode 'features=live' \
--data-urlencode 'sort_by=relevance'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/youtube/search_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"keyword": "咖啡",
"upload_date": "last_hour",
"type": "video",
"duration": "SHORT",
"features": "live",
"sort_by": "relevance",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/youtube/search_v1");
url.search = new URLSearchParams({
keyword: "咖啡",
upload_date: "last_hour",
type: "video",
duration: "SHORT",
features: "live",
sort_by: "relevance",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
Try it
Sign in to call this endpoint from this page. Successful calls are billed to your balance, failed calls are free, and new accounts get $0.50 of trial credit.
Example response
Captured 2026-11-08, took 2745 ms · Request parameters {"type": "video", "keyword": "咖啡", "sort_by": "relevance", "duration": "SHORT", "features": "live", "upload_date": "last_hour"}
JSON
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "youtube.search_v1",
"cost_usd": 0.02,
"data": {
"code": 0,
"data": {
"items": [
{
"id": "lMTsVxJX6RU",
"type": "video",
"title": "Matcha & Espresso Fusion (Starbucks Copycat)",
"channel": {
"id": "UCf5pRWIp3HYKFMcBIBhLXow",
"name": "Ice or Rice",
"type": "channel",
"avatar": [
{
"url": "https://yt3.ggpht.com/ytc/AIdro_mmB_0HV3kHBFjAVZxpTW0G9mo5rMPPvwpaJ7dCuXBveZU=s68-c-k-c0x00ffffff-no-rj",
"width": 68,
"height": 68
}
],
"isVerified": false,
"isVerifiedArtist": false
},
"isLiveNow": false,
"lengthText": "1:12",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/lMTsVxJX6RU/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLA4uh1kX5BsIeyfrVC1pAdWacB_cw",
"width": 360,
"height": 202,
"moving": false
},
{
"url": "https://i.ytimg.com/vi/lMTsVxJX6RU/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB2WY_vN0Dz47AyjapwjcOzckjg_A",
"width": 720,
"height": 404,
"moving": false
},
"… +1"
],
"description": "Matcha Espresso Fusion: http://www.iceorrice.com/matcha-espresso-fusion/ Starbucks unveiled this matcha espresso fusion, ...",
"viewCountText": "214,299 views",
"publishedTimeText": "9 years ago"
},
{
"id": "4gPltH46H_k",
"type": "video",
"title": "鹿晗 Luhan(Lộc Hàm ) X 吴亦凡WuYifan/Kris Wu(Ngô Diệc Phàm) - 咖啡 (Coffee) 官方The Official MV 【中英双语】",
"channel": {
"id": "UCk86qnXDmBwX4sKI5dHAdcw",
"name": "风华秋实 RF ENTERTAINMENT",
"type": "channel",
"avatar": [
{
"url": "https://yt3.ggpht.com/ytc/AIdro_mLaZIVyOWA3GjQgJf3d2UPbinPzMhfFoTxqlyxhOCWSw=s68-c-k-c0x00ffffff-no-rj",
"width": 68,
"height": 68
}
],
"isVerified": true,
"isVerifiedArtist": false
},
"isLiveNow": false,
"lengthText": "3:25",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/4gPltH46H_k/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAJaNpE5_ieLDh1NE7dFfx9Gdo6CQ",
"width": 480,
"height": 270,
"moving": false
},
{
"url": "https://i.ytimg.com/an_webp/4gPltH46H_k/mqdefault_6s.webp?du=3000&sqp=CNDdvtcG&rs=AOn4CLA4tx5n9VAA2lrpKR_gmuskI9gVfA",
"width": 320,
"height": 180,
"moving": true
}
],
"description": "欢迎订阅频道哦:https://is.gd/csfgDI 开启小铃铛 第一时间观看专属你的精彩内容哦~ Welcome to subscribe my channel Open this ...",
"viewCountText": "2,428,095 views",
"publishedTimeText": "6 years ago"
},
"… +18"
],
"errorId": "Success",
"nextToken": "search-videos.EpcDEgblkpbllaEajANFZ1FRQVJnQlNCU0NBUXRzVFZSelZuaEtXRFpTVllJQkN6Um5VR3gwU0RRMlNGOXJnZ0VMWW5aWGJXRXphM0ZVWWxtQ0FRczVjV2hJWldKSVZsOUtaNElCQ3pVM1YxQndiMVZIVkRKUmdnRUxPV1EzZUZZMlRGSk9RMk9DQV…"
},
"message": null,
"requestId": "71102665796b4fba8f141bf6eead6ffa",
"recordTime": "2026-11-08T08:00:07.553484794",
"requestParams": {
"body": null,
"query": {
"type": "video",
"sortBy": "relevance",
"keyword": "咖啡",
"duration": "SHORT",
"features": "live",
"upload_date": "last_hour"
}
}
}
}