ruboty-bokete 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/bokete/client.rb +5 -4
- data/lib/ruboty/bokete/version.rb +1 -1
- 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: 6544c8b122280deebf01f0a342b3613668b7568e
|
4
|
+
data.tar.gz: 2035986702a98b650147b49d71870a94db8441a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37dd6ebc7bb3643fce701cf2ce89619487bdd10b90564a8cd192658c5717e0cf724ade98772fbf8e6436a29ecd3a501223a305233625f8bcc4989a96d4c45fec
|
7
|
+
data.tar.gz: 2df59c9df61898c661ae41ec034999065d25085adaee225dbf8350bea7482585b3480739823d43b3dc3caf81b685f8f06d8fb772df4a90aaaf8c849f751b5c09
|
data/lib/ruboty/bokete/client.rb
CHANGED
@@ -5,24 +5,25 @@ class Client
|
|
5
5
|
|
6
6
|
def initialize(max_results: 30)
|
7
7
|
@max_results = max_results
|
8
|
-
@results = []
|
9
8
|
@agent = Mechanize.new
|
10
9
|
end
|
11
10
|
|
12
11
|
def get(mode)
|
12
|
+
results = []
|
13
|
+
|
13
14
|
@agent.get("#{BOKETE_URL}/boke/#{mode}") do |page|
|
14
15
|
target_page = page
|
15
16
|
|
16
|
-
while
|
17
|
+
while results.size < @max_results
|
17
18
|
images = scraping_from_page(target_page)
|
18
|
-
|
19
|
+
results.concat(images)
|
19
20
|
|
20
21
|
target_page = get_next_page(target_page)
|
21
22
|
break if target_page.nil?
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
results
|
26
27
|
end
|
27
28
|
|
28
29
|
def scraping_from_page(page)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-bokete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|