PHP视频网站解析器

时间:2013-05-18 19:06:49

标签: php parsing curl simple-html-dom

所以我一直在研究一个php解析器。基本上它应该做的是为视频网址解析器filenuke。但是,当运行以下脚本并单击播放时,它会显示未找到视频,但是当您加载常规filenuke URL时,视频会播放。我不知道该怎么办,谢谢!

<?php

include("simple_html_dom.php");

$url = "http://filenuke.com/fizzoquaog43";
$cookie = tmpfile();

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
$contents = curl_exec($ch);

curl_close($ch);

$html = new simple_html_dom();
$html->load($contents);

$items = $html->find("input[name=id]");
$items2 = $html->find("input[name=fname]");
$items3 = $html->find("input[name=referrer]");
foreach($items as $element) {
    $fid = $element->value;
}
foreach($items2 as $element2) {
    $fname = $element2->value;
}
foreach($items3 as $element3) {
    $referrer = $element3->value;
}

$data = array(
        'op' => 'download1',
        'usr_login' => '',
        'method_free' => 'free',
        'referrer' => null,
        'id' => $fid,
        'filename' => $fname
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
$page = curl_exec($ch);
curl_close($ch);
echo $page;

?>

1 个答案:

答案 0 :(得分:0)

如果你正在使用作曲家,你可以尝试一些php视频网址解析器,而不是自己制作。

例如:https://github.com/ricardofiorani/php-video-url-parser