Jquery 检测是否在我的网页上嵌入youtube视频

Jquery 检测是否在我的网页上嵌入youtube视频,jquery,youtube,youtube-api,Jquery,Youtube,Youtube Api,如果我在我的网页上嵌入youtube视频,是否可以使用jquery/javascript检测视频是否已关闭(由于版权或用户关闭视频) 感谢您的帮助。您可以使用YouTube数据API v3使用javascript检索视频数据: 您可以检查视频是否存在,尝试检索视频数据: 检索视频数据后,您可以验证以下字段: contentDetails.regionRestriction The regionRestriction object contains information about the

如果我在我的网页上嵌入youtube视频,是否可以使用jquery/javascript检测视频是否已关闭(由于版权或用户关闭视频)


感谢您的帮助。

您可以使用YouTube数据API v3使用javascript检索视频数据:

您可以检查视频是否存在,尝试检索视频数据:

检索视频数据后,您可以验证以下字段:

contentDetails.regionRestriction

The regionRestriction object contains information about the countries where a video is (or is not) viewable. The object will contain either the contentDetails.regionRestriction.allowed property or the contentDetails.regionRestriction.blocked property.

contentDetails.regionRestriction.allowed[]

A list of region codes that identify countries where the video is viewable. If this property is present and a country is not listed in its value, then the video is blocked from appearing in that country. If this property is present and contains an empty list, the video is blocked in all countries.

contentDetails.regionRestriction.blocked[]

A list of region codes that identify countries where the video is blocked. If this property is present and a country is not listed in its value, then the video is viewable in that country. If this property is present and contains an empty list, the video is viewable in all countries.