Class: Morris::VideoScraper
- Inherits:
-
Object
- Object
- Morris::VideoScraper
- Defined in:
- lib/morris/scrapers/video_scraper.rb
Defined Under Namespace
Classes: VideoDownloadError
Constant Summary collapse
- @@morris_logger =
Logger.new(STDOUT)
Class Method Summary collapse
Class Method Details
.lookup(url) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/morris/scrapers/video_scraper.rb', line 21 def self.lookup(url) @@morris_logger.debug("Morris started downloading video with id: #{@id}") start_time = Time.now filename = "#{Morris.temp_storage_location}/morris_media_#{SecureRandom.uuid}.mp4" # line = Terrapin::CommandLine.new("yt-dlp", "-f :filetype -o :filename :url") line = Terrapin::CommandLine.new("yt-dlp", "-f ':filetype' -o :filename :url") line.run(filename: filename, filetype: "mp4", url: url) @@morris_logger.debug("YoutubeArchiver finished downloading video with id: #{@id}") @@morris_logger.debug("Save location: #{filename}") @@morris_logger.debug("Time to download: #{(Time.now - start_time).round(3)} seconds") filename rescue Terrapin::ExitStatusError => e # yt-dlp command returns a non-zero exit status raise VideoDownloadError.new(e.) # Retryable error end |