Explore our Marketplace to buy and sell APIs, services, and social media solutions. Connect with a vibrant community of developers, businesses, and creators!
根据YouTube的搜索逻辑,Shorts搜索有以下特性:
filter_mixed_content=true(默认),自动过滤掉长视频filter_mixed_content=false,获取原始混合内容search_query (string)
"Python编程", "gaming", "cooking tutorial"language_code (string, 可选)
"en-US""zh-CN" - 简体中文"zh-TW" - 繁体中文"en-US" - 英语(美国)"en-GB" - 英语(英国)"ja-JP" - 日语"ko-KR" - 韩语"es-ES" - 西班牙语"fr-FR" - 法语"de-DE" - 德语language_code=zh-CNcountry_code (string, 可选)
"US""US" - 美国"CN" - 中国"JP" - 日本"KR" - 韩国"GB" - 英国"DE" - 德国"FR" - 法国"CA" - 加拿大country_code=JPtime_zone (string, 可选)
"America/Los_Angeles""America/Los_Angeles" - 美国太平洋时区"America/New_York" - 美国东部时区"Asia/Shanghai" - 中国时区"Asia/Tokyo" - 日本时区"Europe/London" - 英国时区"Europe/Paris" - 法国时区time_zone=Asia/Shanghaifilter_mixed_content (boolean, 可选)
truetrue - 自动过滤长视频,只返回Shorts(推荐)false - 返回原始内容,可能包含长视频filter_mixed_content=truetrue: 当你只需要纯Shorts内容时使用(推荐首次请求使用)false: 当你需要分析YouTube原始返回的混合内容时使用(调试用)upload_time (string, 可选)
null (不过滤)"hour" - 过去1小时内上传"today" - 今天上传(基于time_zone参数)"week" - 本周上传(最近7天)"month" - 本月上传(最近30天)"year" - 今年上传(最近365天)upload_time=weeksort_by (string, 可选)
null (YouTube默认相关性排序)"relevance" - 按相关性排序(YouTube默认算法)"upload_date" - 按上传日期排序(最新优先)"view_count" - 按观看次数排序(最多观看优先)"rating" - 按评分排序(最高评分优先)sort_by=view_countrelevance: 寻找最相关的内容upload_date: 寻找最新发布的Shortsview_count: 寻找最受欢迎的Shortsrating: 寻找质量最高的Shortscontinuation_token (string, 可选)
null (获取第一页)continuation_token=EqcBEgPkuKzor4YybhmgGk...从响应JSON中提取,路径通常为以下之一:
# 路径1:在 onResponseReceivedCommands 中
response["data"]["onResponseReceivedCommands"][0]["appendContinuationItemsAction"]["continuationItems"][-1]["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"]
# 路径2:在 contents 中
response["data"]["contents"]["twoColumnSearchResultsRenderer"]["primaryContents"]["sectionListRenderer"]["contents"][-1]["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"]
GET /api/v1/youtube_web/get_shorts_search?search_query=python
GET /api/v1/youtube_web/get_shorts_search?search_query=python&continuation_token=xxx
{
"code": 200,
"data": {
"contents": {
"twoColumnSearchResultsRenderer": {
"primaryContents": {
"sectionListRenderer": {
"contents": [
{
"itemSectionRenderer": {
"contents": [
{
"gridShelfViewModel": {
// Shorts视频列表
"items": [...]
}
}
]
}
},
{
"continuationItemRenderer": {
"continuationEndpoint": {
"continuationCommand": {
"token": "xxx" // 下一页的token
}
}
}
}
]
}
}
}
}
}
}
According to YouTube's search logic, Shorts search has these characteristics:
filter_mixed_content=true (default) to automatically filter long videosfilter_mixed_content=false to get original mixed contenthour: Shorts uploaded in the past hourtoday: Shorts uploaded todayweek: Shorts uploaded this weekmonth: Shorts uploaded this monthyear: Shorts uploaded this yearrelevance: Relevance (default)upload_date: Upload dateview_count: View countrating: RatingExtract from response JSON, typically at one of these paths:
# Path 1: In onResponseReceivedCommands
response["onResponseReceivedCommands"][0]["appendContinuationItemsAction"]["continuationItems"][-1]["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"]
# Path 2: In contents
response["contents"]["twoColumnSearchResultsRenderer"]["primaryContents"]["sectionListRenderer"]["contents"][-1]["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"]
GET /api/v1/youtube_web/get_shorts_search?search_query=python
GET /api/v1/youtube_web/get_shorts_search?search_query=python&continuation_token=xxx
{
"code": 200,
"data": {
"contents": {
"twoColumnSearchResultsRenderer": {
"primaryContents": {
"sectionListRenderer": {
"contents": [
{
"itemSectionRenderer": {
"contents": [
{
"gridShelfViewModel": {
// Shorts video list
"items": [...]
}
}
]
}
},
{
"continuationItemRenderer": {
"continuationEndpoint": {
"continuationCommand": {
"token": "xxx" // Token for next page
}
}
}
}
]
}
}
}
}
}
}
GET /youtube_web/get_shorts_search?search_query=Python编程
GET /youtube_web/get_shorts_search?search_query=Python编程&filter_mixed_content=false
GET /youtube_web/get_shorts_search?search_query=python&upload_time=week
GET /youtube_web/get_shorts_search?search_query=技术&sort_by=view_count
GET /youtube_web/get_shorts_search?search_query=编程&continuation_token=EqcBEgPkuKzor4YybhmgGk...