You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

115 lines
3.3 KiB

<?php
namespace App\Console\Commands;
use App\Repositories\BilibiliVideoRepository;
use App\Services\BilibiliServiceV2;
use App\Services\FfmpegService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;
use Nesk\PuPHPeteer\Puppeteer;
class BiliVideoCode extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bili:nvtuan {type} {code} {path} {startPos=0}';
/**
* 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
* @throws \Exception
*/
public function handle() {
$bilibili = new BilibiliServiceV2(new BilibiliVideoRepository(App::getFacadeApplication()));
// $startPos = $this->argument("startPos");
// echo "startPos is $startPos";
// $bilibili->queryUpVideoList(10278125, $startPos);
// exit;
$bilibili->downloadDynamics();exit;
$browserFactory = new \HeadlessChromium\BrowserFactory();
// starts headless Chrome
$browser = $browserFactory->createBrowser(['windowSize' => [1920, 1000]]);
try {
// creates a new page and navigate to an URL
$page = $browser->createPage();
$page->navigate('https://bilibili.com')->waitForNavigation();
// get page title
$pageTitle = $page->evaluate('document.title')->getReturnValue();
// screenshot - Say "Cheese"! 😄
$page->screenshot()->saveToFile('/Users/shixuesen/Downloads/bar.png');
// pdf
// $page->pdf(['printBackground' => false])->saveToFile('/foo/bar.pdf');
} finally {
// bye
$browser->close();
}
exit;
// $bilibili->checkVideoHasDownload();
// $bilibili->queryLocalUpVideoList();exit;
// $bilibili->insertDBTest();exit;
// $bilibili->queryPlayList();
// $bilibili->downloadDynamics();exit;
$startPos = $this->argument("startPos");
echo "startPos is $startPos";
$bilibili->queryUpVideoList(10278125, $startPos);
exit;
// $bilibili->queryDBCollectionList();
// dump($bilibili->requestVideoParts("33483603"));exit;
$bilibili->queryForVideoParts();exit;
$bilibili->compareAndDownloadUpVideos(true);
$bilibili->compareAndDownloadCollectionVideos();
exit;
$bilibili->queryForVideoParts();
if (App::environment() == "local") {
# code...
exit;
}
date_default_timezone_set('PRC');
$path = $this->argument("path");
$service = new FfmpegService();
// $service->checkFileEncodeType();exit;
$service->processDir(trim($path));
exit;
// $bilibili->compareAndDownloadUpVideos();
// exit;
// $bilibili->compareAndDownloadCollectionVideos();
// $bilibili->queryCollectionList();
// $bilibili->compareAndDownloadNewVideos();
// $bilibili->queryLocalUpVideoList();
// $bilibili->queryForVideoParts();
// $bilibili->queryDBCollectionList();
// $bilibili->checkVideoHasDownload();
// echo is_dir("/Volumes/Seagate Backup Plus Drive/Video/bilibili/少女时代");
}
}