Open 466878778 opened 4 years ago
function singlePage($page_url, $title)
{
if (checkExist($title)) {
return;
}
$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";
}
}
2楼的方法完美解决 管用 谢谢。
- ssh 登录群晖
- 执行 sudo docker exec -it 91porn /bin/sh 进入docker容器
- 进入91porn目录,用vi detailPage.php 编辑detailPage.php文件
- 把function singlePage($page_url, $title)的这段代码替换为
function singlePage($page_url, $title) { if (checkExist($title)) { return; } $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"; } }
- 保存退出
替换这个之后报这个错误
sh: syntax error: unexpected "(" ====js解密====
Warning: DOMDocument::loadHTML(): Empty string supplied as input in /root/91porn/vendor/imangazaliev/didom/src/DiDom/Document.php on line 253
Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /root/91porn/detailPage.php:46 Stack trace:
thrown in /root/91porn/detailPage.php on line 46
- ssh 登录群晖
- 执行 sudo docker exec -it 91porn /bin/sh 进入docker容器
- 进入91porn目录,用vi detailPage.php 编辑detailPage.php文件
- 把function singlePage($page_url, $title)的这段代码替换为
function singlePage($page_url, $title) { if (checkExist($title)) { return; } $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"; } }
- 保存退出
替换这个之后报这个错误
sh: syntax error: unexpected "(" ====js解密====
Warning: DOMDocument::loadHTML(): Empty string supplied as input in /root/91porn/vendor/imangazaliev/didom/src/DiDom/Document.php on line 253
Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /root/91porn/detailPage.php:46 Stack trace:
0 /root/91porn/91porn.php(20): singlePage('http://627.work...', '\xE4\xB8\x8A\xE6\xB5\xB7\xE5\x91\xA8\xE8\xBE\xB9\xE7\x94\xB5...')
1 /root/91porn/91porn.php(24): listPage()
2 {main}
thrown in /root/91porn/detailPage.php on line 46
之前是有用的就昨天发现爬不起来了,不知道什么鬼。估计是网站改了什么玩意 要等作者修复了,
docker 里面下载只能下载几条视频后面就下载不起来了。
没有分享链接
Fatal error: Uncaught Error: Call to a member function text() on null in /root/91porn/detailPage.php:32 Stack trace:
0 /root/91porn/91porn.php(20): singlePage('http://627.work...', '\xE4\xB9\x96\xE4\xB9\x96\xE5\xA5\xB3\xE8\xB6\x81\xE7\x88\xB6...')
1 /root/91porn/91porn.php(24): listPage()
2 {main}
thrown in /root/91porn/detailPage.php on line 32
不知道这怎么搞 群晖dock 里面的配置文件怎么修改呢 搞了半天没找到怎么修改,