Module: Scrapers

Defined in:
lib/scrapers/imgur.rb,
lib/scrapers.rb,
lib/netrc_reader.rb,
lib/scrapers/esod.rb,
lib/scrapers/xkcd.rb,
lib/scrapers/sinfest.rb,
lib/scrapers/version.rb,
lib/scrapers/download.rb,
lib/scrapers/gocomics.rb,
lib/scrapers/nasa_apod.rb,
lib/scrapers/rubytapas.rb,
lib/scrapers/allrecipes.rb,
lib/scrapers/wunderground.rb,
lib/scrapers/discoverynews.rb,
lib/scrapers/manning_books.rb,
lib/scrapers/rubytapas/cli.rb,
lib/scrapers/rubytapas/config.rb,
lib/scrapers/manning_dashboard.rb,
lib/scrapers/rubytapas/dpdcart.rb,
lib/scrapers/rubytapas/episode.rb,
lib/scrapers/rubytapas/scraper.rb

Overview

require ‘pry’

Defined Under Namespace

Modules: AllRecipes, DiscoNews, Download, Esod, GoComics, ManningBooks, ManningDashboard, NasaApod, RubyTapas, Sinfest, Version, Wunderground, Xkcd Classes: Imgur, NetrcReader

Constant Summary collapse

IMGUR_TEMPLATE =
"http://imgur.com/path"
VERSION =
[Version::MAJOR,Version::MINOR,Version::BUILD].map(&:to_s).join(".")
DESCRIPTION =
"A library of web site scrapers utilizing mechanize and other goodies. Helpful in gathering images, moving things, saving things, etc."
SUMMARY =
"Web site scrapers"
LICENSE =
"MIT"
WEBSITE =
"http://github.com/tamouse/scrapers"

Class Method Summary collapse

Class Method Details

.agentObject



5
6
7
# File 'lib/scrapers.rb', line 5

def self.agent()
  @agent ||= Mechanize.new
end

.base_url(url) ⇒ Object



9
10
11
12
13
# File 'lib/scrapers.rb', line 9

def self.base_url(url)
  u = URI.parse(url)
  u.path=''
  u.to_s
end

.imgur(url) ⇒ Object



51
52
53
54
# File 'lib/scrapers/imgur.rb', line 51

def imgur(url)
  code = File.basename(url).sub(/\.[^.]+$/,'')
  "http://imgur.com/download/#{code}/"
end