From 897b68ac107f2fb0d4dc1d31ce96ce24c862eb27 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Fri, 19 Jun 2020 21:05:19 +0100 Subject: Add youtube video and audio scraping commands --- app/Console/Commands/ScrapeYoutube.php | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 app/Console/Commands/ScrapeYoutube.php (limited to 'app/Console/Commands') diff --git a/app/Console/Commands/ScrapeYoutube.php b/app/Console/Commands/ScrapeYoutube.php new file mode 100644 index 0000000..ce64d3f --- /dev/null +++ b/app/Console/Commands/ScrapeYoutube.php @@ -0,0 +1,57 @@ +argument('url'); + $format = $this->argument('format'); + + $service = new Service($url, $this->output); + + if ($format == 'video') { + $video = $service->downloadVideo('video'); + } elseif ($format == 'audio') { + $video = $service->downloadAudio('audio'); + } + + $this->info('Download of ' . $video->getTitle() . ' complete!'); + + return Command::SUCCESS; + } + +} -- cgit v1.2.3