dongzecai0684 2013-07-13 04:10
浏览 28


Is there any way for a website to let users embed ONLY short youtube videos. Let's say 2min or shorter.

So when they try to embed the youtube video and if it's over 2 minutes they get an error that tells them "Your video is too long, please choose another" etc...

Is this possible?

Just to be clear, I'm not looking to edit the youtube video length, just prohibit users from posting of videos that are too long.

Thank you very much.

  • 写回答

2条回答 默认 最新

  • doublel83422 2013-07-13 04:31

    Here's to help you get started:

    The base api URL is

    $video_data = json_decode(file_get_contents(""),true);
    echo $video_data['entry']['title']['$t']." is ".$video_data['entry']['media$group']['yt$duration']['seconds']." seconds long.";


    Love, Fate, Love - Final Approach ED Single Love, Fate, Love Original Soundtrack is 283 seconds long.

    Replace a_kAUiJwRs0 with your video ID. You may print_r on $video_data to see all the values you get.

    Once you have their video ID, you may check if their duration (in seconds) is longer or shorter than 120 seconds, and reject or accept based on that.

    I would recommending reading this to see what video responses will have. (You can always var_dump to see exactly what it returns)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥66 定制开发肯德基自动化网站下单软件
  • ¥20 vscode虚拟环境依赖包未安装
  • ¥15 odoo17关于owl开发js代码问题
  • ¥15 光纤中多普勒频移公式的推导
  • ¥15 怎么制作一个人脸识别门禁系统
  • ¥20 大华dss监控平台网络关闭登不进去
  • ¥15 请使用蚁群算法解决下列问题,并给出我完整的代码
  • ¥20 关于php录入完成后,批量更新数据库
  • ¥15 请教往复密封润滑问题
  • ¥15 cocos creator发布ios包