class Panchira::PixivNovelResolver

Constants

URL_REGEXP

Public Class Methods

new(url) click to toggle source
Calls superclass method
# File lib/panchira/resolvers/pixiv_resolver.rb, line 50
def initialize(url)
  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

Private Instance Methods

parse_author() click to toggle source
# File lib/panchira/resolvers/pixiv_resolver.rb, line 64
def parse_author
  @json['body']['userName']
end
parse_tags() click to toggle source
# File lib/panchira/resolvers/pixiv_resolver.rb, line 68
def parse_tags
  @json['body']['tags']['tags'].map { |content| content['tag'] }
end
parse_title() click to toggle source
# File lib/panchira/resolvers/pixiv_resolver.rb, line 60
def parse_title
  @json['body']['title']
end