Sha256: 5f276ccd3b66244973c5693db31a1de5a984a8048b4377c155601e9644f6de20

Contents?: true

Size: 752 Bytes

Versions: 19

Compression:

Stored size: 752 Bytes

Contents

require 'mechanize'

module Scrapers
  module Sinfest
    SINFEST_URL = "http://sinfest.net"
    
    def self.scrape
      results = Hash.new
      results[:comic] = 'Sinfest'
      results[:url] = SINFEST_URL
      Mechanize.start do |agent|
        agent.get SINFEST_URL
        agent.current_page.image(src: %r{comikaze/comics}).tap do |comic|
          results[:title] = comic.alt.to_s
          results[:img_src] = comic.src.to_s
          comicdate = Date.parse(File.basename(comic.src.to_s,'.gif'))
          pubdate = Time.utc(comicdate.year,comicdate.month,comicdate.day)
          results[:pubdate] = pubdate.to_s
        end
      end
      results.tap{|t| $stderr.puts "DEBUG: #{caller(0,1).first} results #{t.inspect}"}
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
scrapers-3.2.0 lib/scrapers/sinfest.rb
scrapers-3.1.0 lib/scrapers/sinfest.rb
scrapers-3.0.0 lib/scrapers/sinfest.rb
scrapers-2.1.0 lib/scrapers/sinfest.rb
scrapers-2.0.2 lib/scrapers/sinfest.rb
scrapers-2.0.1 lib/scrapers/sinfest.rb
scrapers-2.0.0 lib/scrapers/sinfest.rb
scrapers-1.5.6 lib/scrapers/sinfest.rb
scrapers-1.5.5 lib/scrapers/sinfest.rb
scrapers-1.5.4 lib/scrapers/sinfest.rb
scrapers-1.5.3 lib/scrapers/sinfest.rb
scrapers-1.5.2 lib/scrapers/sinfest.rb
scrapers-1.5.1 lib/scrapers/sinfest.rb
scrapers-1.5.0 lib/scrapers/sinfest.rb
scrapers-1.4.0 lib/scrapers/sinfest.rb
scrapers-1.3.0 lib/scrapers/sinfest.rb
scrapers-1.2.0 lib/scrapers/sinfest.rb
scrapers-1.1.0 lib/scrapers/sinfest.rb
scrapers-1.0.0 lib/scrapers/sinfest.rb