manga_fetch 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 57196b36b8540e47a645ca3251a74fbf26f89c58
4
+ data.tar.gz: 5e06b108569aa706c252938303467366e8c6b8c2
5
+ SHA512:
6
+ metadata.gz: ed589e1983c8c02a88df428595cf4a373a50bcf514db589de3508e054e704321b3ff87ca3741d21db9c07a17843578ea90e486130f24a93beba4cde42a2d43fc
7
+ data.tar.gz: 1b3f7e0f38991ae9e83f852b830e7a8cf52b4d6370eebdd1df1d0041bb1049c9846675e1e6d7072b486d8cfe8e97b2f4b358129c4dd1f84397af074371aea67c
checksums.yaml.gz.sig ADDED
Binary file
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'nomorebeer', '~> 1', '>= 1.1.1' # action against drunk driving
4
+ gem 'mechanize', '~> 2.7', '>= 2.7.5'
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ domain_name (0.5.20160615)
5
+ unf (>= 0.0.5, < 1.0.0)
6
+ http-cookie (1.0.2)
7
+ domain_name (~> 0.5)
8
+ mechanize (2.7.5)
9
+ domain_name (~> 0.5, >= 0.5.1)
10
+ http-cookie (~> 1.0)
11
+ mime-types (>= 1.17.2)
12
+ net-http-digest_auth (~> 1.1, >= 1.1.1)
13
+ net-http-persistent (~> 2.5, >= 2.5.2)
14
+ nokogiri (~> 1.6)
15
+ ntlm-http (~> 0.1, >= 0.1.1)
16
+ webrobots (>= 0.0.9, < 0.2)
17
+ mime-types (3.1)
18
+ mime-types-data (~> 3.2015)
19
+ mime-types-data (3.2016.0521)
20
+ mini_portile2 (2.1.0)
21
+ net-http-digest_auth (1.4)
22
+ net-http-persistent (2.9.4)
23
+ nokogiri (1.6.8)
24
+ mini_portile2 (~> 2.1.0)
25
+ pkg-config (~> 1.1.7)
26
+ nomorebeer (1.1.1)
27
+ ntlm-http (0.1.1)
28
+ pkg-config (1.1.7)
29
+ unf (0.1.4)
30
+ unf_ext
31
+ unf_ext (0.0.7.2)
32
+ webrobots (0.1.2)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ mechanize (~> 2.7, >= 2.7.5)
39
+ nomorebeer (~> 1, >= 1.1.1)
40
+
41
+ BUNDLED WITH
42
+ 1.12.5
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # MangaFetch
2
+
3
+ ```sh
4
+ manga_fetch berserk 1..10
5
+ ```
data/bin/manga_fetch ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/manga_fetch"
4
+
5
+ $verbose = true
6
+
7
+ m = ARGV[1].match(/\A(\d+)\.\.(\d+)\Z/)
8
+ nums = m[1].to_i .. m[2].to_i
9
+
10
+ list = MangaFetch.fetch(name: ARGV[0], num: nums)
11
+ puts list
@@ -0,0 +1,43 @@
1
+ require "mechanize"
2
+ require "colorize"
3
+
4
+ module MangaFetch
5
+ extend self
6
+
7
+ # Fetch some pages form the manga named like `name`
8
+ def fetch(name: "berserk", num: nil)
9
+ init_agent("http://www.mangareader.net/#{name}")
10
+
11
+ images = if num.is_a? Fixnum
12
+ [ fetch_one(num) ]
13
+ elsif num.is_a? Enumerable
14
+ fetch_list(num)
15
+ end
16
+ end
17
+
18
+ def init_agent(url)
19
+ @agent = Mechanize.new
20
+ @agent.get url
21
+ @main = @agent.page
22
+ end
23
+
24
+ def fetch_one(num)
25
+ # links = @main.search("#listing td a").map{|e| e[:href]}
26
+ # link = links.find{|e| e.split("/").last == num.to_s}
27
+ link = "#{@main.uri.to_s}/#{num}"
28
+ STDERR.puts "Fetching Tome [".blue + "#{num}".yellow + "]".blue if $verbose
29
+ first_page = @agent.get(link)
30
+
31
+ last_page_num = first_page.at("#selectpage").text.split.last.to_i
32
+ (1..last_page_num).map do |i|
33
+ STDERR.puts "Fetching Image [".blue + "#{i} / #{last_page_num}".yellow + "]".blue if $verbose
34
+ current_page = @agent.get "#{first_page.uri.to_s}/#{i}"
35
+ image = current_page.at("#img")[:src]
36
+ STDERR.puts "-> ".blue + image.red if $verbose
37
+ end
38
+ end
39
+
40
+ def fetch_list(nums)
41
+ nums.map{|num| fetch_one(num)}
42
+ end
43
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ��4����a�U����[���.(��9��5�n��b�����%�XԹ̻V�0�=+��œ���9�"�W�L��3�)#/.h�a/�F=�TX�_�� *�0g��>�Yt7|���fb�x^������5Ye�c�t ��L1�*�̯���Ԟ8�����6��k(�A�%�:���qv�Y?a�%L�����`Q w��u�� ^%�+�q*�;�M�l-���RF��Y��}^�,�ׇIt�1��;P��Ϣ�"
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: manga_fetch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Arthur Poulet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRYwFAYDVQQDDA1hcnRo
14
+ dXIucG91bGV0MRkwFwYKCZImiZPyLGQBGRYJY3J5cHRvbGFiMRMwEQYKCZImiZPy
15
+ LGQBGRYDbmV0MB4XDTE1MTAwMzIxNTQyMFoXDTE2MTAwMjIxNTQyMFowSDEWMBQG
16
+ A1UEAwwNYXJ0aHVyLnBvdWxldDEZMBcGCgmSJomT8ixkARkWCWNyeXB0b2xhYjET
17
+ MBEGCgmSJomT8ixkARkWA25ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBANnLB9vH7/O0aUWi0f9VtC7F73zMC1OvxDaJq+qIcmGBFiKPOngDCRyKffWf
19
+ A6gyf7VsJAlDVFYoyNw7bzLFjBT9gkb5xmED3Uaxvt8Ax131YvKv0sTsQeiTVHHW
20
+ 1crq7266hW1McrFU2A1uQRV8FHuruUJBuP7UUYK7fZi0barbkdAIb4VvQFZxXByI
21
+ lKdQSuhu8k0RcG1vTACEsQXJIUImc8CWMi8/TG3HidJdASMvIWtV2rNQXlQ+UgIc
22
+ UeHC0p+SNTrc09H6q+5eH8NRYhJ91xKuLXv7NNy8M3quAMHcQ1GM6DWljc+Jc4cm
23
+ uAPQMYJf7Vy6OzWLoEiv2QU6sE0CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQU08cDEZOTZNjP/0+E2unJWyw4NzQwJgYDVR0RBB8w
25
+ HYEbYXJ0aHVyLnBvdWxldEBjcnlwdG9sYWIubmV0MCYGA1UdEgQfMB2BG2FydGh1
26
+ ci5wb3VsZXRAY3J5cHRvbGFiLm5ldDANBgkqhkiG9w0BAQUFAAOCAQEAo60BuRZM
27
+ 5Vtn0H0kHHTPiXz09lwxx4cFpTqrTTM0T6qM3gKsR5eLyR1Rt5hGmYLPgY4ZW4zI
28
+ XcuDbgRJrczZs7AZNy5NXyVWpxCwkZzklpbGTuYQdFz7mKfVyALjLjrilOIktXcz
29
+ PvB7EoLlqYvq9cnwV3WE1MkRcBd07xpofcp0kxae2dCOZPUq24TcNaRe7Utw6jjA
30
+ iL0bcH7zZkzMsNoNpPAgsd3ovU4Mf9M+A3M8COmd7KzKyZ0k7P12u5InPWUsNQS2
31
+ tcYkgfqUJPitIJx1RvWZpIyH5uJhRUYK3+vU9nMOxez5WbIlC1TtpByKAPMX+sht
32
+ gib3AoIT8jh/2w==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-08-26 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: nomorebeer
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.1
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.1.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: colorize
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.8'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.8.1
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.8'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ - !ruby/object:Gem::Dependency
77
+ name: mechanize
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.7'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.7.5
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '2.7'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.7.5
96
+ description: manga_fetch is a gem to download a manga
97
+ email: arthur.poulet@mailoo.org
98
+ executables:
99
+ - manga_fetch
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - README.md
106
+ - bin/manga_fetch
107
+ - lib/manga_fetch.rb
108
+ homepage: http://rubygems.org/gems/manga_fetch
109
+ licenses:
110
+ - WTFPL
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.5.1
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: manga_fetch is a gem to download a manga
132
+ test_files: []
133
+ has_rdoc:
metadata.gz.sig ADDED
Binary file