nyaa_anime 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nyaa_anime.rb +14 -6
- data/lib/nyaa_anime/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d114871e4368e1d3fbee2e706f31592009178192
|
4
|
+
data.tar.gz: f5716d1fbf597abc7a6de8872672ca53472696aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d325d829bd96a04090c6719e4064f31dbbb59713e9c1e4d6f00bc654ef1cb5d515859b44bb40ee40e291b3518dc28030821b0a4f5d4ced559413b94874c5f3
|
7
|
+
data.tar.gz: 7a1b51b5b736fc67164e523009a59432189ede39f474167f1e7d298664d1188e5d38e98ee7fd7b293c0e0eef7a5a245f92e61172c4381563ca26f97b76014142
|
data/lib/nyaa_anime.rb
CHANGED
@@ -31,10 +31,18 @@ class NyaaAnime
|
|
31
31
|
if page_urls.count == MAX_PAGE_COUNT - 1
|
32
32
|
puts "Truncating at #{MAX_PAGE_COUNT} pages." unless quiet
|
33
33
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
if page_urls.count > 1
|
35
|
+
page_titles = [nil] * (page_urls.count - 1)
|
36
|
+
page_dl_urls = [nil] * (page_urls.count - 1)
|
37
|
+
Parallel.each_with_index(page_urls, in_threads: 10) do |url, i|
|
38
|
+
r = Nokogiri::HTML(open(url)).css('.tlistrow')
|
39
|
+
page_titles[i] = r.css('.tlistname a').map { |a| a.content }
|
40
|
+
page_dl_urls[i] = r.css('.tlistdownload a').map { |a| a.attr('href') }
|
41
|
+
print "."
|
42
|
+
end
|
43
|
+
print "\n"
|
44
|
+
page_titles.each { |pt| titles.concat pt }
|
45
|
+
page_dl_urls.each { |pd| dl_urls.concat pd }
|
38
46
|
end
|
39
47
|
titles.each_with_index { |t, i| @downloads[t] = dl_urls[i] }
|
40
48
|
@titles = titles.sort!
|
@@ -161,11 +169,11 @@ class NyaaAnime
|
|
161
169
|
end
|
162
170
|
|
163
171
|
def download_all
|
164
|
-
Parallel.map(@titles) { |t| download(t) }
|
172
|
+
Parallel.map(@titles, in_threads: 10) { |t| download(t) }
|
165
173
|
end
|
166
174
|
|
167
175
|
def download_all_new
|
168
|
-
Parallel.map(@new_titles) { |t| download(t) }
|
176
|
+
Parallel.map(@new_titles, in_threads: 10) { |t| download(t) }
|
169
177
|
end
|
170
178
|
|
171
179
|
def download_count
|
data/lib/nyaa_anime/version.rb
CHANGED