Sha256: f6518122c80d7fe138906c0cd8df0f02e39cada14e858fee8c17f0fc126633b7
Contents?: true
Size: 587 Bytes
Versions: 1
Compression:
Stored size: 587 Bytes
Contents
require 'nokogiri' require 'httpclient' require 'kinomax_parser/announce' require 'kinomax_parser/movie' require "kinomax_parser/version" module KinomaxParser NotFound = Class.new StandardError Empty = Class.new StandardError def self.fetch(url) HTTPClient.new.get url, nil, { 'User-Agent'=>'a', 'Accept-Encoding'=>'a' } end def self.parse(url) p = fetch url raise(Empty) if p.http_body.content.size.zero? p.status == 200 ? Nokogiri::XML(p.body.encode('utf-8')) : raise(NotFound) end end class Hash def compact delete_if { |k, v| v.nil? } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kinomax_parser-0.1.0 | lib/kinomax_parser.rb |