Maison > Article > développement back-end > 正则抓取土豆视频解决办法
正则抓取土豆视频
如题. http://www.tudou.com/listplay/Icl7UAlbQZs/6YFO9qJvtts.html
求高手抓出此链接的视频地址
------解决方案--------------------
你只要用tudou的播放播放就会有广告。
------解决方案--------------------
$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>