Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬 这个报错怎么回事,麻烦看一下啊!! #57

Open
KimiBear opened this issue Feb 7, 2020 · 6 comments
Open

大佬 这个报错怎么回事,麻烦看一下啊!! #57

KimiBear opened this issue Feb 7, 2020 · 6 comments

Comments

@KimiBear
Copy link

KimiBear commented Feb 7, 2020

Fatal error: Uncaught Error: Call to a member function text() on null in /root/91porn/detailPage.php:32
Stack trace:
#0 /root/91porn/91all.php(23): singlePage('http://627.work...', '\xE6\x8A\x8A\xE5\xB0\x8F\xE5\xB0\x91\xE5\xA6\x87\xE8\x8D\x89...')
#1 /root/91porn/91all.php(35): listPage('http://627.work...', 1, 10)
#2 {main}
thrown in /root/91porn/detailPage.php on line 32

@leozvc
Copy link

leozvc commented Feb 8, 2020

91porn_php/detailPage.php
第14行 改为 $source = $page->first('#player_one source') 即可

@KimiBear
Copy link
Author

KimiBear commented Feb 9, 2020

91porn_php/detailPage.php
第14行 改为 $source = $page->first('#player_one source') 即可

@leozvc

`<?php
require 'vendor/autoload.php';
require 'Aria2.php';
require 'config.php';
use DiDom\Document;
use DiDom\Query;

function random_ip()
{
$a = rand(0, 255);
$b = rand(0, 255);
$c = rand(0, 255);
$d = rand(0, 255);
return $a.'.'.$b.'.'.$c.'.'.$d;
}

function singlePage($page_url, $title)
{
if (checkExist($title)) {
return;
}

$html = getHtml($page_url);
$page = new Document($html);

$shareLink = $page->first('#linkForm2 #fm-video_link');
if ($shareLink) {
	$sharePage = new Document(getHtml($shareLink->text()));
	$videoUrl = $sharePage->first('source')->getAttribute('src');
}else{
	echo "没有分享链接\n";
	$cipher = $page->first('#vid script')->text();
	$videoUrl = decode($cipher);
}

echo $videoUrl."\n";

download($videoUrl, $title);

}

function getHtml($url) {
$header = array();
$header[] = "Accept-Language:zh-CN,zh;q=0.9";
$header[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)Chrome/51.0.2704.106 Safari/537.36";
$header[] = "X-Forwarded-For:".random_ip();
$header[] = "Content-Type: multipart/form-data; session_language=cn_CN";
$header[] = "Referer:".$url;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT,300);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if (property_exists('Config', 'proxy') && (Config::$url=='91porn.com')) {
	curl_setopt($ch, CURLOPT_PROXY, Config::$proxy);
}

$data = curl_exec($ch);
curl_close($ch);
return $data;

}

function decode($cipher)
{
$js = file_get_contents('http://91porn.com/js/md5.js');
$file = fopen('./md5.js',"w+");
fputs($file,$js.'console.log(strencode(process.argv[2], process.argv[3], process.argv[4]));');//写入文件
fclose($file);
$cipher = substr($cipher, 55);
$cipher = substr($cipher, 0, strlen($cipher)-19);
$cipher = str_replace('","', ' ', $cipher);
$tag = shell_exec('node ./md5.js '.$cipher);
$videoUrl = explode("<source src='", $tag)[1];
$videoUrl = explode("' type='video/mp4", $videoUrl)[0];
return $videoUrl;
}

function download($videoUrl, $title) {
$aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc');
$result = $aria2->addUri(
[$videoUrl],
['dir'=>DIR.'/videos', 'out'=>$title.'.mp4']
);
if ($result['result']) {
echo "\033[0;32m"."提交Aria2成功!"."\033[0m\n";
}else {
echo "\033[0;31m"."提交Aria2失败!!!"."\033[0m\n";
}
}

function checkExist($title) {
$filePath = DIR.'/videos/'.$title.'.mp4';

if (file_exists($filePath)){
	echo "\033[0;34m"."文件已存在"."\033[0m\n";
	return true;
}

$aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc');

foreach ($aria2->tellActive()['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频正在下载"."\033[0m\n";
		return true;
	}
}

foreach ($aria2->tellWaiting(0, 1000)['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频正在等待下载"."\033[0m\n";
		return true;
	}
}

foreach ($aria2->tellStopped(0, 1000)['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频已经下载"."\033[0m\n";
		return true;
	}
}
return false;

}

if (count($argv)>1) {
singlePage($argv[1], "");
}

修改哪个呢!可否标注出来!谢谢啦!`

@kuckyhappy
Copy link

first('#player_one source'); if ($source) { $videoUrl = $source->getAttribute('src'); echo "====直接解析====\n"; } // 分享链接也没有的话再解密 if (!$videoUrl) { $cipher = $page->first('#player_one script')->text(); $videoUrl = decode($cipher); echo "====js解密====\n"; } // 如果source取不到就找分享链接 if (!$videoUrl) { $shareLink = $page->first('#linkForm2 #fm-video_link'); $sharePage = new Document(getHtml($shareLink->text())); $videoUrl = $sharePage->first('source')->getAttribute('src'); echo "====分享链接====\n"; } $date = $page->find('//*[@id="videodetails-content"]/span[2]', Query::TYPE_XPATH)[0]->text(); echo $videoUrl."\n"; download($videoUrl, $title); }catch(Exception $e) { echo "这个视频没找到,请排查是否需要挂载代理\n"; } } function getHtml($url) { $header = array(); $header[] = "Accept-Language:zh-CN,zh;q=0.9"; $header[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)Chrome/51.0.2704.106 Safari/537.36"; $header[] = "X-Forwarded-For:".random_ip(); $header[] = "Content-Type: multipart/form-data; session_language=cn_CN"; $header[] = "Referer:".$url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT,300); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); if (property_exists('Config', 'proxy') && (Config::$url=='91porn.com')) { curl_setopt($ch, CURLOPT_PROXY, Config::$proxy); } $data = curl_exec($ch); curl_close($ch); return $data; } function decode($cipher) { $js = file_get_contents('https://91porn.com/js/md5.js'); $file = fopen('./md5.js',"w+"); fputs($file,$js.'console.log(strencode(process.argv[2], process.argv[3], process.argv[4]));');//写入文件 fclose($file); $cipher = substr($cipher, 55); $cipher = substr($cipher, 0, strlen($cipher)-19); $cipher = str_replace('","', ' ', $cipher); $tag = shell_exec('node ./md5.js '.$cipher); $videoUrl = explode("addUri( [$videoUrl], ['dir'=>__DIR__.'/videos', 'out'=>$title.'.mp4'] ); if ($result['result']) { echo "\033[0;32m"."提交Aria2成功!"."\033[0m\n"; }else { echo "\033[0;31m"."提交Aria2失败!!!"."\033[0m\n"; } } function checkExist($title) { $filePath = __DIR__.'/videos/'.$title.'.mp4'; if (file_exists($filePath)){ echo "\033[0;34m"."文件已存在"."\033[0m\n"; return true; } $aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc'); foreach ($aria2->tellActive()['result'] as $item) { if ($item['files'][0]['path'] == $filePath) { echo "\033[0;34m"."该视频正在下载"."\033[0m\n"; return true; } } foreach ($aria2->tellWaiting(0, 1000)['result'] as $item) { if ($item['files'][0]['path'] == $filePath) { echo "\033[0;34m"."该视频正在等待下载"."\033[0m\n"; return true; } } foreach ($aria2->tellStopped(0, 1000)['result'] as $item) { if ($item['files'][0]['path'] == $filePath) { echo "\033[0;34m"."该视频已经下载"."\033[0m\n"; return true; } } return false; } if (count($argv)>1) { singlePage($argv[1], ""); }

@kuckyhappy
Copy link

`<?php
require 'vendor/autoload.php';
require 'Aria2.php';
require 'config.php';
use DiDom\Document;
use DiDom\Query;

function random_ip()
{
$a = rand(0, 255);
$b = rand(0, 255);
$c = rand(0, 255);
$d = rand(0, 255);
return $a.'.'.$b.'.'.$c.'.'.$d;
}

function singlePage($page_url, $title)
{
$html = getHtml($page_url);
$page = new Document($html);

try {
	$videoUrl = "";
	// 先直接取source
	$source = $page->first('#player_one source');
	if ($source) {
		$videoUrl = $source->getAttribute('src');
		echo "====直接解析====\n";
	}

	// 分享链接也没有的话再解密
	if (!$videoUrl) {
		$cipher = $page->first('#player_one script')->text();	
		$videoUrl = decode($cipher);
		echo "====js解密====\n";
	}

	// 如果source取不到就找分享链接
	if (!$videoUrl) {
		$shareLink = $page->first('#linkForm2 #fm-video_link');
		$sharePage = new Document(getHtml($shareLink->text()));
    $videoUrl = $sharePage->first('source')->getAttribute('src');
    echo "====分享链接====\n";
	}
	$date = $page->find('//*[@id="videodetails-content"]/span[2]', Query::TYPE_XPATH)[0]->text();

  echo $videoUrl."\n";
download($videoUrl, $title);
}catch(Exception $e) {
	echo "这个视频没找到,请排查是否需要挂载代理\n";
}

}

function getHtml($url) {
$header = array();
$header[] = "Accept-Language:zh-CN,zh;q=0.9";
$header[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)Chrome/51.0.2704.106 Safari/537.36";
$header[] = "X-Forwarded-For:".random_ip();
$header[] = "Content-Type: multipart/form-data; session_language=cn_CN";
$header[] = "Referer:".$url;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT,300);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if (property_exists('Config', 'proxy') && (Config::$url=='91porn.com')) {
	curl_setopt($ch, CURLOPT_PROXY, Config::$proxy);
}

$data = curl_exec($ch);
curl_close($ch);
return $data;

}

function decode($cipher)
{
$js = file_get_contents('https://91porn.com/js/md5.js');
$file = fopen('./md5.js',"w+");
fputs($file,$js.'console.log(strencode(process.argv[2], process.argv[3], process.argv[4]));');//写入文件
fclose($file);
$cipher = substr($cipher, 55);
$cipher = substr($cipher, 0, strlen($cipher)-19);
$cipher = str_replace('","', ' ', $cipher);
$tag = shell_exec('node ./md5.js '.$cipher);
$videoUrl = explode("<source src='", $tag)[1];
$videoUrl = explode("' type='video/mp4", $videoUrl)[0];
return $videoUrl;
}

function download($videoUrl, $title) {
$aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc');
$result = $aria2->addUri(
[$videoUrl],
['dir'=>DIR.'/videos', 'out'=>$title.'.mp4']
);
if ($result['result']) {
echo "\033[0;32m"."提交Aria2成功!"."\033[0m\n";
}else {
echo "\033[0;31m"."提交Aria2失败!!!"."\033[0m\n";
}
}

function checkExist($title) {
$filePath = DIR.'/videos/'.$title.'.mp4';

if (file_exists($filePath)){
	echo "\033[0;34m"."文件已存在"."\033[0m\n";
	return true;
}

$aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc');

foreach ($aria2->tellActive()['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频正在下载"."\033[0m\n";
		return true;
	}
}

foreach ($aria2->tellWaiting(0, 1000)['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频正在等待下载"."\033[0m\n";
		return true;
	}
}

foreach ($aria2->tellStopped(0, 1000)['result'] as $item) {
	if ($item['files'][0]['path'] == $filePath) {
		echo "\033[0;34m"."该视频已经下载"."\033[0m\n";
		return true;
	}
}
return false;

}

if (count($argv)>1) {
singlePage($argv[1], "");
}
`

@kuckyhappy
Copy link

前后`去掉就可以了

@KimiBear
Copy link
Author

前后`去掉就可以了

@kuckyhappy
先谢谢啦!我去试试!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants