Class: Panchira::PixivNovelResolver
- Defined in:
- lib/panchira/resolvers/pixiv_resolver.rb
Constant Summary collapse
- URL_REGEXP =
/pixiv\.net\/novel\/show.php\?id=(\d+)/.freeze
Instance Method Summary collapse
-
#initialize(url, options = nil) ⇒ PixivNovelResolver
constructor
A new instance of PixivNovelResolver.
Methods inherited from Resolver
Constructor Details
#initialize(url, options = nil) ⇒ PixivNovelResolver
Returns a new instance of PixivNovelResolver.
72 73 74 75 76 77 78 |
# File 'lib/panchira/resolvers/pixiv_resolver.rb', line 72 def initialize(url, = nil) super(url, ) @novel_id = url.slice(URL_REGEXP, 1) raw_json = URI.parse("https://www.pixiv.net/ajax/novel/#{@novel_id}").read('User-Agent' => user_agent) @json = JSON.parse(raw_json) end |