jae-jae / QueryList

:spider: The progressive PHP crawler framework! 优雅的渐进式PHP采集框架。
https://querylist.cc
2.66k stars 441 forks source link

请求部分网址导致setHtml参数错误 #142

Closed Xieyongmin closed 3 years ago

Xieyongmin commented 3 years ago

源地址:https://finance.sina.com.cn/money/bank/gsdt/2021-06-25/doc-ikqciyzk1700282.shtml

$query_list = QueryList::get(源地址);

$query_list->html();

在执行上面代码后报错如下,框架使用的是thinkphp6最新stable版本: [think\exception\ThrowableError] Type error: Too few arguments to function QL\Dom\Query::setHtml(), 0 passed in /data/www/baodan_web/vendor/jaeger/querylist/src/QueryList.php on line 65 and at least 1 expected

Exception trace: () at /data/www/baodan_web/vendor/jaeger/querylist/src/Dom/Query.php:46 QL\Dom\Query->setHtml() at /data/www/baodan_web/vendor/jaeger/querylist/src/QueryList.php:65 QL\QueryList->call() at /data/www/baodan_web/vendor/jaeger/querylist/src/Providers/SystemServiceProvider.php:19 QL\QueryList->QL\Providers{closure}() at n/a:n/a Closure->call() at /data/www/baodan_web/vendor/jaeger/querylist/src/QueryList.php:67 QL\QueryList->call() at /data/www/baodan_web/application/common/library/spider/Sina.php:61 app\common\library\spider\Sina->fetch_content() at /data/www/baodan_web/application/common/library/Article.php:498 app\common\library\Article::create_article() at /data/www/baodan_web/application/common/library/Article.php:150 app\common\library\Article::create() at /data/www/baodan_web/application/common/command/CronTemp.php:42 app\common\command\CronTemp->_handeler() at /data/www/baodan_web/application/common/command/CronTemp.php:34 app\common\command\CronTemp->execute() at /data/www/baodan_web/thinkphp/library/think/console/Command.php:175 think\console\Command->run() at /data/www/baodan_web/thinkphp/library/think/Console.php:630 think\Console->doRunCommand() at /data/www/baodan_web/thinkphp/library/think/Console.php:230 think\Console->doRun() at /data/www/baodan_web/thinkphp/library/think/Console.php:167 think\Console->run() at /data/www/baodan_web/thinkphp/library/think/Console.php:124 think\Console::init() at /data/www/baodan_web/think:22

麻烦看看是什么原因

imxieke commented 3 years ago

你这用法就不对 我不知道你想干啥 我给你个示例

// 实例一个对象 也可以 直接使用不进行实例化
$ql = \QL\QueryList::getInstance();
// 设置 url 获取 html 内容
$info = $ql->get($url)->todo;
// 设置 html 内容
$info = $ql->html($html)->todo;
// 上面两个方法一样的效果 都可以进行 find 
// 你两个一起用爬虫也蒙蔽 还不传参

仅供参考 看你用户名 不知道是不是我老谢家的 :bowtie: