Sha256: b35cd377e6469d0ecfd53531aa54e4269cdbe4b5424ed49e2d36fbdf523e34dd
Contents?: true
Size: 597 Bytes
Versions: 1
Compression:
Stored size: 597 Bytes
Contents
require 'nokogiri' require 'httpclient' require 'ruskino33_parser/announce' require 'ruskino33_parser/movie' require "ruskino33_parser/version" module Ruskino33Parser # Headers are needed to mimic proper request to ruskino33 def self.fetch(url) HTTPClient.new.get url, nil, { 'User-Agent'=>'a', 'Accept-Encoding'=>'a' } end # Returns a nokogiri document or an error if fetch response status is not 200 def self.parse(url) p = fetch url raise(Empty) if p.http_body.content.size.zero? p.status == 200 ? Nokogiri::HTML(p.body.encode('utf-8')) : raise(NotFound) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruskino33_parser-0.1.1 | lib/ruskino33_parser.rb |