nhentai-api 0.2.1 → 0.2.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/nhentai-api.rb +13 -4
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32a8382ebb1c8c5d33c1ea5baa94070fc31c788e31c628c7708fa6b29d839d94
|
4
|
+
data.tar.gz: 1481e553fa7663d4898b07f60814413be9efb5ccd8c233bf84d0c08281edf934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 585e38f3cb7d7397158535f4bca3dd10fde1fb70bcf4ecddff39eaee1178a6f1cb50ad668897e838087265ab1d61e1617bddbdcede672d1f8de46fd6a5945a7c
|
7
|
+
data.tar.gz: a5246ab1e9eec631fed5a883822e9190bf004e88840b6cc9d3a13cb516371019a61c77a7808d04eaebd325ba5a23e823c930351f16f5063164cc8b963fd5c2e5
|
data/lib/nhentai-api.rb
CHANGED
@@ -20,7 +20,7 @@ class Doujinshi
|
|
20
20
|
@client = Net::HTTP.get_response(URI("https://nhentai.net/g/#{@id}/"))
|
21
21
|
if self.exists?
|
22
22
|
@media_id = @client.body.match(%r{\/([0-9]+)\/cover})[1]
|
23
|
-
@count_pages = @client.body.match(/([0-9]+)
|
23
|
+
@count_pages = @client.body.match(/Pages:\s*.*>([0-9]+)</)[1].to_i
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -45,7 +45,7 @@ class Doujinshi
|
|
45
45
|
# doujinshi.title #=> '[Illumination. (Ogadenmon)] Android no Ecchi na Yatsu | Horny Androids (NieR:Automata) [English] =TLL + mrwayne= [Digital]'
|
46
46
|
#
|
47
47
|
def title
|
48
|
-
@client.body.match(
|
48
|
+
@client.body.match(/"pretty">(.*?)</)[1]
|
49
49
|
end
|
50
50
|
|
51
51
|
#
|
@@ -141,7 +141,7 @@ class Doujinshi
|
|
141
141
|
# doujinshi.upload_date #=> 2018-01-17 15:56:16 +0000
|
142
142
|
#
|
143
143
|
def upload_date
|
144
|
-
Time.iso8601(@client.body.match(
|
144
|
+
Time.iso8601(@client.body.match(/<time .+ datetime="(.*?)"/)[1])
|
145
145
|
end
|
146
146
|
|
147
147
|
#
|
@@ -154,6 +154,7 @@ class Doujinshi
|
|
154
154
|
#
|
155
155
|
def tags
|
156
156
|
res = @client.body.match(%r{Tags:\s*<span class="tags">(.+)<\/span>})
|
157
|
+
return [] if res.nil?
|
157
158
|
|
158
159
|
parse_tags(res[1])
|
159
160
|
end
|
@@ -192,6 +193,7 @@ class Doujinshi
|
|
192
193
|
#
|
193
194
|
def parodies
|
194
195
|
res = @client.body.match(%r{Parodies:\s+<span class="tags">(.+)<\/span>})
|
196
|
+
return [] if res.nil?
|
195
197
|
|
196
198
|
parse_tags(res[1])
|
197
199
|
end
|
@@ -226,6 +228,7 @@ class Doujinshi
|
|
226
228
|
#
|
227
229
|
def characters
|
228
230
|
res = @client.body.match(%r{Characters:\s+<span class="tags">(.+)<\/span>})
|
231
|
+
return [] if res.nil?
|
229
232
|
|
230
233
|
parse_tags(res[1])
|
231
234
|
end
|
@@ -260,6 +263,7 @@ class Doujinshi
|
|
260
263
|
#
|
261
264
|
def artists
|
262
265
|
res = @client.body.match(%r{Artists:\s+<span class="tags">(.+)<\/span>})
|
266
|
+
return [] if res.nil?
|
263
267
|
|
264
268
|
parse_tags(res[1])
|
265
269
|
end
|
@@ -294,6 +298,7 @@ class Doujinshi
|
|
294
298
|
#
|
295
299
|
def groups
|
296
300
|
res = @client.body.match(%r{Groups:\s+<span class="tags">(.+)<\/span>})
|
301
|
+
return [] if res.nil?
|
297
302
|
|
298
303
|
parse_tags(res[1])
|
299
304
|
end
|
@@ -328,6 +333,7 @@ class Doujinshi
|
|
328
333
|
#
|
329
334
|
def languages
|
330
335
|
res = @client.body.match(%r{Languages:\s+<span class="tags">(.+)<\/span>})
|
336
|
+
return [] if res.nil?
|
331
337
|
|
332
338
|
parse_tags(res[1])
|
333
339
|
end
|
@@ -362,6 +368,7 @@ class Doujinshi
|
|
362
368
|
#
|
363
369
|
def categories
|
364
370
|
res = @client.body.match(%r{Categories:\s+<span class="tags">(.+)<\/span>})
|
371
|
+
return [] if res.nil?
|
365
372
|
|
366
373
|
parse_tags(res[1])
|
367
374
|
end
|
@@ -398,9 +405,11 @@ class Doujinshi
|
|
398
405
|
res.split(%r{<a(.+?)<\/a>}).reject(&:empty?).map do |line|
|
399
406
|
id = line.match(/tag-(\d+)/)[1]
|
400
407
|
name = line.match(/">(.+?)</)[1].strip
|
401
|
-
count = line.match(
|
408
|
+
count = line.match(/class="count">(\d+.)</)[1]
|
402
409
|
url = line.match(/href=\"(.+?)\"/)[1]
|
403
410
|
|
411
|
+
count = count[-1] == 'K' ? count.to_i * 1000 : count.to_i
|
412
|
+
|
404
413
|
Info.new(id, name, count, url)
|
405
414
|
end
|
406
415
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nhentai-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gael Roussel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: nhentai-api is a basic and easy to use API for nhentai.net
|
14
|
-
email:
|
14
|
+
email: gaelroussel@protonmail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
@@ -22,7 +22,7 @@ licenses:
|
|
22
22
|
- MIT
|
23
23
|
metadata:
|
24
24
|
documentation_uri: https://www.rubydoc.info/github/groussel42/nhentai-api
|
25
|
-
source_code_uri: https://github.com/
|
25
|
+
source_code_uri: https://github.com/Mraiih/nhentai-api
|
26
26
|
post_install_message:
|
27
27
|
rdoc_options: []
|
28
28
|
require_paths:
|
@@ -38,7 +38,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
|
-
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.7.6
|
42
43
|
signing_key:
|
43
44
|
specification_version: 4
|
44
45
|
summary: nhentai-api is a basic and easy to use API for nhentai.net
|