Sha256: 417258c78b1859dc2f705c9d92cbc763babd20f0eeed5efab2775d6b14d3bd37

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

# Base downloader class intherited by SongDownloader and PlaylistDownloader
class Downloader
  extend Memoist

  attr_accessor :url, :name, :counter, :settings

  YOUTUBE_BASE_URL = 'youtube.com'.freeze
  YOUTUBE_HTTPS_URL = "https://www.#{YOUTUBE_BASE_URL}".freeze
  YOUTUBE_SEARCH_URL = "#{YOUTUBE_HTTPS_URL}/results?search_query=".freeze
  YOUTUBE_WATCH_URL = "#{YOUTUBE_HTTPS_URL}/watch?v=".freeze
  MAXIMUM_NUMBER_OF_TRIES = 3

  def parse_name(title)
    title = title.slice(0, title.rindex('-')) if title.include? '-'
    title.strip
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ytsongdw-0.2.0 lib/downloader.rb
ytsongdw-0.1.4 lib/downloader.rb
ytsongdw-0.1.3 lib/downloader.rb