You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Youtube API获取视频描述被截断至150-160字符问题求助

YouTube API Video Description Truncated (150-160 chars) - Fix & Community Update

Hey there, you’re totally not alone in this! Over the past two weeks, tons of developers have reported the exact same issue—suddenly the video description pulled via the YouTube Search API is getting cut off at ~150-160 characters, even though it used to return the full text just fine.

Why this started happening

The snippet.description field from the Search.list endpoint was always intended to return a truncated preview of the video description, not the full thing. It seems YouTube recently tightened up the truncation rules (or adjusted the character limit) which is why you’re seeing this change now—before, you might have been getting full descriptions by accident for shorter videos that didn’t hit the old cutoff.

How to get the full, untruncated description

To fetch the complete description reliably, you’ll need to add a second call to the Videos.list endpoint using the video IDs you get from your initial search. Here’s how to adjust your workflow:

  1. Keep your existing search query to grab video IDs:
search_response = youtube_instance.search().list(
    q = query,
    part = "id, snippet",
    publishedBefore=str(date_string) + "T23:59:59.000Z",
    publishedAfter=str(date_string) + "T00:00:00.000Z",
    type = 'channel, video',
    maxResults = max_results
).execute()
  1. Extract all valid video IDs from the search results (skip channel entries):
video_ids = [item['id']['videoId'] for item in search_response['items'] if item['id']['kind'] == 'youtube#video']
  1. Call the Videos.list endpoint with these IDs to get full metadata (including complete descriptions):
videos_response = youtube_instance.videos().list(
    part="snippet",
    id=','.join(video_ids)
).execute()

# Access full descriptions here
for video in videos_response['items']:
    full_description = video['snippet']['description']
    # Use the full description as needed

Quick reminders

  • The Search API will never consistently return full descriptions—its snippet is designed for previews only.
  • You can batch up to 50 video IDs per Videos.list call to keep your API request count low.
  • This approach is the official, supported way to get complete video metadata from YouTube.

内容的提问来源于stack exchange,提问作者agata

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:58:20