buapi 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/buapi.rb +47 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0af344f4051e44370b806095d5a573b1c9ad0f70
|
4
|
+
data.tar.gz: ba293acfaf6a23b77dad996ec57cc2e67457bde8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0492d633cc8671044fdc0444036d4a74e405712ab20ebc838d38acb88b68bdaa6c741f8445317c7a5eb925465b9eaf51a526c8667350c9574a9ad279e466b8b6
|
7
|
+
data.tar.gz: 7ce8c558693b36a29717e25d589439c9d907f4f2ae8c4dd931675fa2f8286c37b158929af0f286980cddb58909d024b1f67936c4be8da0b9ce76c32d72949cb2
|
data/lib/buapi.rb
CHANGED
@@ -12,46 +12,6 @@ module BU
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def doc(url)
|
16
|
-
Nokogiri::HTML(@conn.get(url).body)
|
17
|
-
end
|
18
|
-
|
19
|
-
def search(target, post_options)
|
20
|
-
Nokogiri::HTML(
|
21
|
-
@conn.post(target, post_options).body
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def releases(term)
|
26
|
-
search('/search.html', {search: term})
|
27
|
-
end
|
28
|
-
|
29
|
-
def manga(term, type: 'title')
|
30
|
-
search('/series.html', {stype: type, search: term})
|
31
|
-
end
|
32
|
-
|
33
|
-
def series_url(manga)
|
34
|
-
doc = manga(manga)
|
35
|
-
link = doc.css('a').find do |a|
|
36
|
-
a[:alt] == "Series Info" && a.text.downcase == manga.downcase
|
37
|
-
end
|
38
|
-
link ? link[:href].sub(@root, '') : :no_match
|
39
|
-
end
|
40
|
-
|
41
|
-
def series_description(info)
|
42
|
-
info[0].text
|
43
|
-
end
|
44
|
-
|
45
|
-
def series_genres(info)
|
46
|
-
info[14].css('a')[0..-2].map {|a| a.text}
|
47
|
-
end
|
48
|
-
|
49
|
-
def series_scanlators(info)
|
50
|
-
info[4].css('a')
|
51
|
-
.select {|a| a.text != "Less..." && a.text != "More..." }
|
52
|
-
.map {|a| {uri: a[:href], name: a.text} }
|
53
|
-
end
|
54
|
-
|
55
15
|
def series_dashboard(manga)
|
56
16
|
url = series_url(manga)
|
57
17
|
info = doc(url).css('.sMember div.sContent')
|
@@ -62,6 +22,53 @@ module BU
|
|
62
22
|
scanlators: series_scanlators(info),
|
63
23
|
}
|
64
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def doc(url)
|
28
|
+
Nokogiri::HTML(@conn.get(url).body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def search(target, post_options)
|
32
|
+
Nokogiri::HTML(
|
33
|
+
@conn.post(target, post_options).body
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def releases(term)
|
38
|
+
search('/search.html', {search: term})
|
39
|
+
end
|
40
|
+
|
41
|
+
def manga(term, type: 'title')
|
42
|
+
search('/series.html', {stype: type, search: term})
|
43
|
+
end
|
44
|
+
|
45
|
+
def series_url(manga)
|
46
|
+
doc = manga(manga)
|
47
|
+
link = doc.css('a').find do |a|
|
48
|
+
a[:alt] == "Series Info" && match_names(a.text, manga)
|
49
|
+
end
|
50
|
+
link ? link[:href].sub(@root, '') : :no_match
|
51
|
+
end
|
52
|
+
|
53
|
+
def series_description(info)
|
54
|
+
info[0].text
|
55
|
+
end
|
56
|
+
|
57
|
+
def series_genres(info)
|
58
|
+
info[14].css('a')[0..-2].map {|a| a.text}
|
59
|
+
end
|
60
|
+
|
61
|
+
def series_scanlators(info)
|
62
|
+
info[4].css('a')
|
63
|
+
.select {|a| a.text != "Less..." && a.text != "More..." }
|
64
|
+
.map {|a| {uri: a[:href], name: a.text} }
|
65
|
+
end
|
66
|
+
|
67
|
+
def match_names(name, other)
|
68
|
+
name = name.clone.gsub(/\W/, '')
|
69
|
+
other = other.clone.gsub(/\W/, '')
|
70
|
+
name.downcase == other.downcase
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jphager2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Useful interface BakaUpdates
|
14
14
|
email: jphager2@gmail.com
|