<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\XiaoyuService;
|
|
use App\Services\XiurenjiService;
|
|
use App\Services\YouwuService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class XiurenjiScrape extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'xiuren:s {all} {site} {num} {start}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Command description';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
//
|
|
$isAll = $this->argument('all');
|
|
$site = $this->argument("site");
|
|
$num = $this->argument("num");
|
|
$start = $this->argument("start");
|
|
// if ($site == "xiuren") {
|
|
$service = new XiurenjiService();
|
|
// } else if ($site == "xiaoyu") {
|
|
// $service = new XiaoyuService();
|
|
// } else if ($site == "youwu"){
|
|
// $service = new YouwuService();
|
|
// }
|
|
|
|
if ($isAll == "1") {
|
|
$service->scrapeAll();
|
|
} else {
|
|
$service->scrapeAlbum($site, $num, $start);
|
|
}
|
|
|
|
// $service->scrapeSingleAlbum("https://www.xiurenji.vip/XiuRen/7828.html");exit;
|
|
|
|
}
|
|
}
|