Home >Backend Development >PHP Tutorial > 正则抓取洋芋视频

正则抓取洋芋视频

WBOY
WBOYOriginal
2016-06-13 12:57:391108browse

正则抓取土豆视频
如题. http://www.tudou.com/listplay/Icl7UAlbQZs/6YFO9qJvtts.html   
求高手抓出此链接的视频地址
------解决方案--------------------
你只要用tudou的播放播放就会有广告。
------解决方案--------------------

$s=file_get_contents('http://www.tudou.com/listplay/Icl7UAlbQZs/6YFO9qJvtts.htm');<br />
preg_match_all('/iid:(\d+)\s+,kw:"(.*?)"\s+.*?icode:"(.*?)"/s',$s,$matches);<br />
<br />
foreach($matches[1] as $k=>$v){<br />
	$name=iconv('GB2312','utf-8',$matches[2][$k]);<br />
	echo "<a href='http://www.tudou.com/l/{$matches[3][$k]}/&iid={$matches[1][$k]}/v.swf'>$name</a><br />";<br />
}

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