汽车之家链接转换,抓取优化

This commit is contained in:
2026-01-23 10:38:36 +08:00
parent da1dc7a3da
commit 323dbac221
2 changed files with 48 additions and 15 deletions
+5 -4
View File
@@ -7,6 +7,7 @@ use app\common\validate\UsedCarValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\UsedCar;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use support\exception\BusinessException;
use support\Log;
use support\Request;
@@ -450,18 +451,18 @@ class UsedCarService
case str_contains($url,'www.che168.com/dealer'): //汽车之家
$info = $usedCarCrawl->crawlChe168Car($url);
break;
case str_contains($url,'www.che168.com/home?infoid='): //汽车之家pc端链接转换
$url = $usedCarCrawl->getChe168UrlByPc($url);
$info = $usedCarCrawl->crawlChe168Car($url);
break;
case str_contains($url,'wap.che168.com/dealer'): //汽车之家移动端链接
$finalUrl = $usedCarCrawl->getChe168UrlByMobile($url);
$info = $usedCarCrawl->crawlChe168Car($finalUrl);
break;
case str_contains($url,'comm.app.autohome.com.cn'): //汽车之家移动端链接
$finalUrl = $usedCarCrawl->get168FinaUrl($url);
var_dump($finalUrl);
$info = $usedCarCrawl->crawlChe168Car($finalUrl);
break;
case str_contains($url,'www.che168.com/dealer'): //汽车之家
$info = $usedCarCrawl->crawlChe168Car($url);
break;
default:
Log::info('未知链接:'.$url);
throw new \Exception('加紧开发中');