dpjs2005 2011-10-07 13:05
浏览 584
已采纳

如何解析youtube网址以获取视频或播放列表ID?

I'm looking for a way to extract both (partials) youtube urls and single ids from a user input string.
This article How do I find all YouTube video ids in a string using a regex? got me going quite well but still i'm struggling a bit.

Is there a way to find both playlist and/or video ids from a strings from:

  • E4uySuFiCis
  • PLBE0103048563C552

Through:

  • 写回答

2条回答 默认 最新

  • dtlhy0771 2011-10-07 13:30
    关注

    use:

    $urlInfo = parse_url($url); // to get url components (scheme:host:query)
    
    $urlVars = array();
    parse_str($queryString, $urlVars); // to get the query vars 
    

    check out the youtube api for more details on the format

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?