如何验证 Vimeo 视频 ID?
How to validate Vimeo video id?
我需要创建一个正则表达式来验证有效的 Vimeo 视频。
根据 Vimeo API 他们只使用数字作为视频 ID,但没有指定长度。
到目前为止我的正则表达式var regEx= /^[0-9]+$/;
我想知道:
- vimeo 视频 ID 支持的允许长度是多少?
- 如何修改我的正则表达式?
我找到的唯一文章:
https://vimeo.com/forums/topic:267078
与其尝试发明 Vimeo 视频 ID 验证器,不如使用 Vimeo developper API 来检查 Vimeo ID 是否有效?
GET https://api.vimeo.com/videos/{video_id}
+------------------+--------------------------------------------------+
| Http Status Code | Explanation |
+------------------+--------------------------------------------------+
| 200 Ok | |
+------------------+--------------------------------------------------+
| 403 | if the video does exist, but the view or the app |
| | requesting the video resource does not have |
| | permission to access that video. |
+------------------+--------------------------------------------------+
| 404 not found | If the video cannot be found. |
+------------------+--------------------------------------------------+
检查您 (1)
或用户 (2)
是否拥有视频:
(1) GET https://api.vimeo.com/me/videos/{video_id}
(2) GET https://api.vimeo.com/users/{user_id}/videos/{video_id}
+------------------+------------------------------------------------------+
| Http Status Code | Explanation |
+------------------+------------------------------------------------------+
| 200 Ok | |
+------------------+------------------------------------------------------+
| 404 not found | If the video is not owned by the authenticated user. |
+------------------+------------------------------------------------------+
我需要创建一个正则表达式来验证有效的 Vimeo 视频。
根据 Vimeo API 他们只使用数字作为视频 ID,但没有指定长度。
到目前为止我的正则表达式var regEx= /^[0-9]+$/;
我想知道: - vimeo 视频 ID 支持的允许长度是多少? - 如何修改我的正则表达式?
我找到的唯一文章: https://vimeo.com/forums/topic:267078
与其尝试发明 Vimeo 视频 ID 验证器,不如使用 Vimeo developper API 来检查 Vimeo ID 是否有效?
GET https://api.vimeo.com/videos/{video_id}
+------------------+--------------------------------------------------+
| Http Status Code | Explanation |
+------------------+--------------------------------------------------+
| 200 Ok | |
+------------------+--------------------------------------------------+
| 403 | if the video does exist, but the view or the app |
| | requesting the video resource does not have |
| | permission to access that video. |
+------------------+--------------------------------------------------+
| 404 not found | If the video cannot be found. |
+------------------+--------------------------------------------------+
检查您 (1)
或用户 (2)
是否拥有视频:
(1) GET https://api.vimeo.com/me/videos/{video_id}
(2) GET https://api.vimeo.com/users/{user_id}/videos/{video_id}
+------------------+------------------------------------------------------+
| Http Status Code | Explanation |
+------------------+------------------------------------------------------+
| 200 Ok | |
+------------------+------------------------------------------------------+
| 404 not found | If the video is not owned by the authenticated user. |
+------------------+------------------------------------------------------+