epub_book 0.1.22 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/epub_book.gemspec +2 -2
- data/lib/epub_book/book.rb +6 -4
- data/lib/epub_book/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 638d65f8185c019abc488c48ce088ef93680cf34725b95ad9be3a28ffae48847
|
4
|
+
data.tar.gz: 919c6c35bf22b80c085bb33655f44aa2ca594ea416d57dd7b9157c622acde718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e58ff84b46ac2830fa900b867ccdf4c68087e770bd9cab61a4604987ad4d7007ba282522eba0a93c0bd40c1d4d5cd9ee8ff3dc90193ae9576924ba480e527384
|
7
|
+
data.tar.gz: e6c23da564154fa17f77d7cc21fe63fd7bddfb3059423b14837a0455acafccc6efc9183dc839a6cccf636366bf3abb832b85f6c73f6d5d87046a490db4ac3914
|
data/epub_book.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_dependency 'http','~>
|
30
|
+
spec.add_dependency 'http','~> 5.0', '>= 5.0.4'
|
31
31
|
spec.add_runtime_dependency 'nokogiri', '~> 1.11', '>= 1.11.4'
|
32
32
|
spec.add_dependency 'eeepub', '~> 0.8.1'
|
33
33
|
spec.add_dependency 'zip-zip', '~> 0.3'
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.27'
|
38
|
-
spec.add_development_dependency "rake", '~>
|
38
|
+
spec.add_development_dependency "rake", '~> 13.0','>= 13.0.6'
|
39
39
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
40
|
spec.add_development_dependency "pry", '~> 0.14', '>= 0.14.1'
|
41
41
|
spec.add_development_dependency "pry-byebug", '~> 3.8', '>= 3.8.0'
|
data/lib/epub_book/book.rb
CHANGED
@@ -17,7 +17,7 @@ require 'yaml'
|
|
17
17
|
#referer 访问原地址
|
18
18
|
#creator 责任人
|
19
19
|
#ext_name 扩展名 epub,txt
|
20
|
-
|
20
|
+
#ignore_txt 忽略字符,带有ignore_txt的行将被删除
|
21
21
|
module EpubBook
|
22
22
|
class Book
|
23
23
|
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36"
|
@@ -212,7 +212,7 @@ module EpubBook
|
|
212
212
|
EpubBook.logger.info "=============去除包含指定忽略字符的行======="
|
213
213
|
EpubBook.logger.info ignore_txt
|
214
214
|
if ignore_txt
|
215
|
-
system("sed -i '
|
215
|
+
system("sed -i -r '/#{ignore_txt}/d' #{book[:file_abs_name]}")
|
216
216
|
end
|
217
217
|
|
218
218
|
end
|
@@ -224,8 +224,10 @@ module EpubBook
|
|
224
224
|
#is valid encoding
|
225
225
|
def judge_encoding(str)
|
226
226
|
EpubBook.logger.info str.encoding
|
227
|
-
|
228
|
-
|
227
|
+
#/<meta.*?charset\s*=[\s\"\']?utf-8/i =~ str ? str : str.force_encoding('gbk').encode!('utf-8',invalid: :replace, undef: :replace)
|
228
|
+
|
229
|
+
str.scrub('')! unless str.valid_encoding?
|
230
|
+
str.encode!('utf-8') if str.encoding.name != 'UTF-8'
|
229
231
|
|
230
232
|
EpubBook.logger.info "-------encode 后 #{str.encoding}"
|
231
233
|
str
|
data/lib/epub_book/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub_book
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qmliu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.0.4
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '5.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.0.4
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: nokogiri
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,20 +118,20 @@ dependencies:
|
|
112
118
|
requirements:
|
113
119
|
- - "~>"
|
114
120
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
121
|
+
version: '13.0'
|
116
122
|
- - ">="
|
117
123
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
124
|
+
version: 13.0.6
|
119
125
|
type: :development
|
120
126
|
prerelease: false
|
121
127
|
version_requirements: !ruby/object:Gem::Requirement
|
122
128
|
requirements:
|
123
129
|
- - "~>"
|
124
130
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
131
|
+
version: '13.0'
|
126
132
|
- - ">="
|
127
133
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
134
|
+
version: 13.0.6
|
129
135
|
- !ruby/object:Gem::Dependency
|
130
136
|
name: rspec
|
131
137
|
requirement: !ruby/object:Gem::Requirement
|