Class: Mangdown::Mangahere
Instance Attribute Summary
#root
Instance Method Summary
collapse
#is_chapter?, #is_manga?, #is_page?, #manga_chapters, #manga_list, #type
Constructor Details
#initialize(uri, doc) ⇒ Mangahere
Returns a new instance of Mangahere.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/mangdown/adapter/mangahere.rb', line 5
def initialize(uri, doc)
super
@root = 'http://www.mangahere.co'
@manga_list_css = 'a.manga_info'
@manga_name_css = 'h1.title'
@chapter_list_css = '.detail_list ul a'
@manga_list_uri = "#{@root}/mangalist/"
@manga_link_prefix = ''
@reverse_chapters = true
@manga_uri_regex =
/#{@root}\/manga\/([^\/]+\/)?/i
@chapter_uri_regex =
/#{@manga_uri_regex}(v\d+\/)?(c\d+\/)(1\.html)?/i
@page_uri_regex = /.+\.(png|jpg|jpeg)$/i
end
|
Instance Method Details
#build_page_uri(uri, manga, chapter, page_num) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/mangdown/adapter/mangahere.rb', line 25
def build_page_uri(uri, manga, chapter, page_num)
if page_num == 1
uri
else
uri.sub(/\/[^\/]*$/, "/#{page_num}.html")
end
end
|
#manga_name ⇒ Object
21
22
23
|
# File 'lib/mangdown/adapter/mangahere.rb', line 21
def manga_name
CGI.unescapeHTML(super.downcase).upcase
end
|
#num_pages ⇒ Object
33
34
35
|
# File 'lib/mangdown/adapter/mangahere.rb', line 33
def num_pages
doc.css('.go_page span.right select')[0].css('option').length
end
|
#page_image_name ⇒ Object
41
42
43
44
|
# File 'lib/mangdown/adapter/mangahere.rb', line 41
def page_image_name
doc.css('.go_page span.right select')[0].css('option[selected]')
.text.rjust(3, '0')
end
|
#page_image_src ⇒ Object
37
38
39
|
# File 'lib/mangdown/adapter/mangahere.rb', line 37
def page_image_src
page_image[:src].sub(/\?.*$/, '')
end
|