Commit 4cb855d
Changed files (1)
src
preview
src/preview/youtube.py
@@ -143,6 +143,10 @@ async def get_youtube_vinfo(video_id: str) -> dict:
info |= {"downloadable": False, "error_msg": f"❌直播还未完成, 当前状态: {glom(resp, 'items.0.snippet.liveBroadcastContent')}"}
if info["is_live"] and not info["live_end"]:
info |= {"downloadable": False, "error_msg": f"❌直播还未完成, 当前状态: {glom(resp, 'items.0.snippet.liveBroadcastContent')}"}
+ blocked_regions = glom(resp, "items.0.contentDetails.regionRestriction.blocked", default=[]) or []
+ if "US" in blocked_regions:
+ info |= {"downloadable": False, "error_msg": f"❌视频在以下国家/地区被屏蔽: {', '.join(blocked_regions)}"}
+
# parse duration
"""For a video that is at least one minute long and less than one hour long, the duration is in the format PT#M#S,
in which the letters PT indicate that the value specifies a period of time, and the letters M and S refer to length in minutes and seconds, respectively.