douju7765 2017-07-30 11:48
浏览 38
已采纳

如何从它的网址获取Facebook视频ID?

I have searched through lots of questions but I can't find the correct solution as Facebook changed it's URL strategies. For example: if the video URL is

https://www.facebook.com/yourstartupsIndia/videos/977323192329199/

How can I get the video id from the url. ie : 977323192329199

  • 写回答

2条回答 默认 最新

  • dsqpx86002 2017-07-30 11:58
    关注

    the regex (\d+)/$, \d mean any digit, and /$ mean ending with /

    preg_match("#(\d+)/$#", 'https://www.facebook.com/yourstartupsIndia/videos/977323192329199/', $vid);
    echo $vid[1];
    # 977323192329199
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?