YouTube 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.
/v1/youtube/search_v1
$0.02
- Price
- $0.02 per successful call, Failed calls are free
- Endpoint ID
youtube.search_v1
Parameters
-
keywordstring OptionalSearch keyword. Required on the first request; leave empty when using a continuation token.
Example
咖啡 -
continuation_tokenstring OptionalPagination token returned by the previous response.
-
upload_datestring OptionalFilter results by upload date.
Available Values:
last_hour: Uploaded within the last hourtoday: Uploaded todaythis_week: Uploaded this weekthis_month: Uploaded this monththis_year: Uploaded this year
Example
last_hour -
typestring OptionalFilter results by result type.
Available Values:
video: Video resultschannel: Channel resultsplaylist: Playlist resultsmovie: Movie results
Example
video -
durationstring OptionalFilter video results by duration. Supported request values: short, medium, long.
Available Values:
SHORT: Short videos under 4 minutesMEDIUM: Medium videos from 4 to 20 minutesLONG: Long videos over 20 minutes
Example
SHORT -
featuresstring OptionalFeature filters separated by commas. Supported values: live, 4k, hd, subtitles, creative_commons, 360, vr180, 3d, hdr.
Example
liveAllowed values
liveFOUR_Khdsubtitlescreative_commonsTHREE_SIXTYvr180THREE_Dhdr -
sort_bystring OptionalSort order for search results.
Available Values:
relevance: Sort by relevanceupload_date: Sort by upload dateview_count: Sort by view countrating: Sort by rating
Example
relevance
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);
Example response
Request parameters {"type": "video", "keyword": "咖啡", "sort_by": "relevance", "duration": "SHORT", "features": "live", "upload_date": "last_hour"}
{
"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"
}
}
}
}
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.
More YouTube endpoints
-
Video Details
$0.02Retrieve public details for a YouTube video identified by video ID. Use it to inspect a known video before further content or comment analysis.
/v1/youtube/get_video_detail_v1
-
Channel Videos
$0.02Retrieve public videos from a YouTube channel, with optional cursor-based pagination. Use it to browse a channel's uploads and continue through additional re…
/v1/youtube/get_channel_videos_v1
-
Video Captions
$0.02Retrieve available caption tracks for a YouTube video or request captions in SRT, XML, JSON3, or plain-text format. Use it to support transcription, accessib…
/v1/youtube/get_video_captions_v1
-
Channel Shorts
$0.02Retrieve public Shorts from a YouTube channel ID with optional continuation-token pagination. Use it to browse a channel's short-form videos and continue thr…
/v1/youtube/get_channel_shorts_v1
-
Video Comment List
$0.02Retrieve first-level comments for a YouTube video with sorting, locale options, and cursor pagination. Use it to review audience discussion or continue throu…
/v1/youtube/get_video_comment_v1
-
Video Sub Comment List
$0.02Retrieve replies associated with a YouTube comment continuation cursor, with optional locale settings. Use it to follow threaded discussion beyond first-leve…
/v1/youtube/get_video_sub_comment_v1