Sha256: c09abdb33e35fcd39a368c00e716550ccf9e7d154d1369c19cbf913fdea12f5b
Contents?: true
Size: 595 Bytes
Versions: 1
Compression:
Stored size: 595 Bytes
Contents
require 'nokogiri' require 'httpclient' require 'ruskino33_parser/anonce' 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.0 | lib/ruskino33_parser.rb |