Class: Panchira::KomifloResolver
- Defined in:
- lib/panchira/resolvers/komiflo_resolver.rb
Overview
KomifloResolver resolves Komiflo. Komiflo has its API server, so we can utilize it.
Constant Summary collapse
- URL_REGEXP =
/komiflo\.com(?:\/#!)?\/comics\/(\d+)/.freeze
Instance Method Summary collapse
-
#initialize(url, options = nil) ⇒ KomifloResolver
constructor
A new instance of KomifloResolver.
Methods inherited from Resolver
Constructor Details
#initialize(url, options = nil) ⇒ KomifloResolver
Returns a new instance of KomifloResolver.
9 10 11 12 13 14 15 |
# File 'lib/panchira/resolvers/komiflo_resolver.rb', line 9 def initialize(url, = nil) super(url, ) @id = url.slice(URL_REGEXP, 1) raw_json = URI.parse("https://api.komiflo.com/content/id/#{@id}").read('User-Agent' => user_agent) @json = JSON.parse(raw_json) end |