first commit

This commit is contained in:
root
2025-06-18 10:31:43 +08:00
commit d9f820b55d
981 changed files with 449311 additions and 0 deletions

26
app/Command/TestClass.php Executable file
View File

@ -0,0 +1,26 @@
<?php
namespace App\Command;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
use Spatie\Crawler\CrawlObservers\CrawlObserver;
class TestClass extends CrawlObserver
{
public function willCrawl(UriInterface $url, ?string $linkText): void
{
echo "即将爬取: {$url}\n";
}
public function crawled(
UriInterface $url, ResponseInterface $response, ?UriInterface $foundOnUrl = null, ?string $linkText = null): void {
var_dump($response);
echo "已成功爬取: {$url} 状态码: " . $response->getStatusCode() . "\n";
}
public function crawlFailed(UriInterface $url, \Throwable $exception, ?UriInterface $foundOnUrl = null, ?string $linkText = null): void
{
echo "爬取失败: {$url} 错误: {$exception->getMessage()}\n";
}
}