Sha256: b492794d86ad32f970db3b01f9fbe3f427e36c5780c36fb462e95bc9ec5217d0
Contents?: true
Size: 1.75 KB
Versions: 4
Compression:
Stored size: 1.75 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' require 'thor' require 'netrc' require 'scrapers/rubytapas' ################################################################################ # # Scraper for RubyTapas episodes. # # (Note: you need to subscribe to RupyTapas to download episodes.) # ################################################################################ class RubyTapasDownload < Thor RUBYTAPAS="rubytapas.dpdcart.com" RUBYTAPAS_EPISODE_URL = "https://#{RUBYTAPAS}/subscriber/post?id=\#{episode}" desc "download", "Downloads the listed episode's files into a new directory with the episode tag in the given directory" method_option :destination, :aliases => %w{-d --dest}, :desc => "Destination to store the downloads", :default => "." method_option :url, :desc => "url to episode downloads (overrides episode)" method_option :episode, :aliases => %w{-e --ep}, :desc => "Episode number" method_option :user, :aliases => %w{-u -U}, :desc => "dpdcart user. Default is read from $HOME/.netrc" method_option :password, :aliases => %w{-p -pw}, :desc => "dpdcart password. Default is read from $HOME/.netrc" def download netrc = Netrc.read user, pw = netrc[RUBYTAPAS] user = options.fetch("user", user) pw = options.fetch("password", pw) url = options.fetch("url", nil) episode = options.fetch("episode", nil) destination = options.fetch("destination", nil) STDERR.puts "destination: #{destination}, episode: #{episode}, url: #{url}, user: #{user}, pw: #{pw.length}" unless url raise "Must give episode or full url" unless episode url = RUBYTAPAS_EPISODE_URL.sub(%r[\#{episode}], episode) end Scrapers::RubyTapas.scrape url, user, pw, destination end end RubyTapasDownload.start
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
scrapers-1.5.1 | bin/rubytapas |
scrapers-1.5.0 | bin/rubytapas |
scrapers-1.4.0 | bin/rubytapas |
scrapers-1.3.0 | bin/rubytapas |