mangdown 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +0,0 @@
1
- require_relative '../lib/mangdown'
2
-
3
- module Mangdown
4
-
5
- extend self
6
-
7
- def fk_uri(uri)
8
- "http://www.fakku.net#{uri}"
9
- end
10
-
11
- def find_chapters(num)
12
- t = 0
13
- fk_list = []
14
- while fk_list.length < num
15
- page = fk_uri("/page/#{t + 1}")
16
-
17
- doc = Mangdown::Tools.get_doc(page)
18
-
19
- doc.css('h2 a.content-title').each do |ch|
20
- fk_list.push([ch.text, ch[:href]])
21
- end
22
-
23
- t += 1
24
- end
25
-
26
- fk_list[0..num-1]
27
- end
28
-
29
- def get_chapters(num)
30
- fk_list = []
31
-
32
- # t.times do |num|
33
-
34
- # page = "http://www.fakku.net/page/#{num + 1}"
35
-
36
- # doc = Mangdown::Tools.get_doc(page)
37
-
38
- # fk_list = doc.css('h2 a.content-title').map {|ch| [ch.text, ch[:href]]}
39
- # end
40
- fk_list = find_chapters(num)
41
-
42
- chapters_list = []
43
-
44
- fk_list.each do |ch|
45
- ch_uri = fk_uri(ch[1])
46
- name = ch[0]
47
-
48
- doc = Mangdown::Tools.get_doc(ch_uri)
49
-
50
- # uri = fk_uri(doc.css('div.images a')[0][:href])
51
- uri = ch_uri + '/read#page=1'
52
-
53
- pages = doc.css('div#right div.left b')[0].text.to_i
54
-
55
- chapters_list.push([uri, name, pages])
56
- end
57
-
58
- chapters_list
59
-
60
- end
61
- end
62
-
63
-
64
- if __FILE__ == $0
65
- t = ARGV[0].to_i
66
- t = 1 if t <= 0
67
-
68
- Mangdown.get_chapters(t)
69
- else
70
- puts "Script loaded"
71
- end
72
-