Home  >  Article  >  Backend Development  >  正则抓取土豆视频解决办法

正则抓取土豆视频解决办法

WBOY
WBOYOriginal
2016-06-13 13:27:39900browse

正则抓取土豆视频
如题. http://www.tudou.com/listplay/Icl7UAlbQZs/6YFO9qJvtts.html  
求高手抓出此链接的视频地址

------解决方案--------------------
你只要用tudou的播放播放就会有广告。
------解决方案--------------------

PHP code
$s=file_get_contents('http://www.tudou.com/listplay/Icl7UAlbQZs/6YFO9qJvtts.htm');
preg_match_all('/iid:(\d+)\s+,kw:"(.*?)"\s+.*?icode:"(.*?)"/s',$s,$matches);

foreach($matches[1] as $k=>$v){
    $name=iconv('GB2312','utf-8',$matches[2][$k]);
    echo "<a href="http://www.tudou.com/l/%7B%24matches%5B3%5D%5B%24k%5D%7D/&iid=%7B%24matches%5B1%5D%5B%24k%5D%7D/v.swf">$name</a><br>";
} <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn