首页 文章

如何验证Vimeo视频ID?

提问于
浏览
0

我需要创建一个可以验证有效Vimeo视频的正则表达式 .

因此,对于Vimeo API,它们仅使用视频ID的数字,但它们不指定长度 .

到目前为止我的正则表达式 var regEx= /^[0-9]+$/;

我想知道: - vimeo视频ID支持的允许长度是多少? - 如何修改我的regEx?

只有我找到的文章:https://vimeo.com/forums/topic:267078

1 回答

  • 2

    为什么不使用Vimeo developper API来检查Vimeo ID是否有效,而不是尝试发明Vimeo Video 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. |
    +------------------+------------------------------------------------------+
    

相关问题