epub_book 0.1.28 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae4f4169c296cb59729448bb121afacba00aa2a72c7818dc9351c98df346162e
4
- data.tar.gz: da0c7ed0365cf0b4fc4e628cbc4eb0723abfc8ee95d7e26c0e87f007206793d8
3
+ metadata.gz: 6cf8db6f2596d52379607516e136094bfa5dd022f6822dbe3ef498ebdd370c8d
4
+ data.tar.gz: 3cae4f05409dc2b8a896a6268d3fd1c4db84c93e301df3a5edc2a6f93eb3330e
5
5
  SHA512:
6
- metadata.gz: 1efc93cf78e29046f6ba2d5027c7cc388e632bc17823c6f50ff2a13515f44490afa8683e696f60c5beda4864410f946795ad6c5b0112cbbef4824d4048ec347b
7
- data.tar.gz: 75dfac752c113f9136b4f4d86541ed7bbc2b76d398466a441aa24c2415d3bac66099c8975f4428bd75cc8a16d9e87054d6f1fd4f6cee94f7039fd1fd8577aa91
6
+ metadata.gz: b195efe1c161fa40b93b83abd5bc8b2e1972834e6862b0755013dd7afc2db76566bf00f4976b66f3ae1e5a31cc565a2684d31be1fab15246381306ebe2fab82d
7
+ data.tar.gz: 6cbce0380faa6e1faa7f9de4f285b9cea578eb6329053c26e7a39387ea6c750bf40d725fd77c751082e0f45e7d4004f56db54a569426f972bd4cb68dc3de4f4e
data/epub_book.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  spec.add_dependency 'http','~> 5.0', '>= 5.0.4'
31
- spec.add_runtime_dependency 'nokogiri', '~> 1.11', '>= 1.11.4'
31
+ spec.add_runtime_dependency 'nokogiri', '~> 1.12', '>= 1.12.4'
32
32
  spec.add_dependency 'eeepub', '~> 0.8.1'
33
33
  spec.add_dependency 'zip-zip', '~> 0.3'
34
34
  spec.add_dependency 'mail', '~>2.7.0'
@@ -126,7 +126,8 @@ module EpubBook
126
126
  def fetch_index(url=nil)
127
127
  book[:files] = []
128
128
  url ||= @index_url
129
- doc = Nokogiri::HTML(judge_encoding(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(url).to_s))
129
+ #doc = Nokogiri::HTML(judge_encoding(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(url).to_s))
130
+ doc = Nokogiri::HTML(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(url).to_s)
130
131
  #generate index.yml
131
132
  EpubBook.logger.info "------Fetch index--#{url}---------------"
132
133
 
@@ -134,18 +135,24 @@ module EpubBook
134
135
  doc1 = if @des_url.nil?
135
136
  doc
136
137
  else
137
- Nokogiri::HTML(judge_encoding(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(generate_abs_url(doc.css(@des_url).attr("href").to_s)).to_s))
138
+ #Nokogiri::HTML(judge_encoding(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(generate_abs_url(doc.css(@des_url).attr("href").to_s)).to_s))
139
+ Nokogiri::HTML(HTTP.headers("User-Agent" => @user_agent ,'Referer'=> @referer).get(generate_abs_url(doc.css(@des_url).attr("href").to_s)).to_s)
138
140
  end
139
141
  get_des(doc1)
140
142
  end
141
143
 
142
144
  #binding.pry
145
+ #EpubBook.logger.info @index_item_css
146
+
143
147
  doc.css(@index_item_css).each do |item|
144
148
  _href = item.attr(@item_attr).to_s
145
149
  next if _href.start_with?('javascript') || _href.start_with?('#')
146
150
 
147
151
  _href = generate_abs_url(_href)
148
152
 
153
+ #EpubBook.logger.info item.inspect
154
+ #EpubBook.logger.info item.text
155
+
149
156
  book[:files] << {label: item.text, url: _href}
150
157
  end
151
158
 
@@ -186,7 +193,7 @@ module EpubBook
186
193
  next if test(?s,content_path)
187
194
 
188
195
  begin
189
- doc_file = Nokogiri::HTML(judge_encoding(HTTP.headers("User-Agent" => @user_agent,'Referer'=> @referer).get(item[:url]).to_s))
196
+ doc_file = Nokogiri::HTML(HTTP.headers("User-Agent" => @user_agent,'Referer'=> @referer).get(item[:url]).to_s)
190
197
 
191
198
  EpubBook.logger.info item[:label]
192
199
  #binding.pry
@@ -201,7 +208,7 @@ module EpubBook
201
208
  txt_file.write("\n")
202
209
  doc_file.css(@body_css).children.each do |it|
203
210
  if it.name == 'text'
204
- text_file.write(it.text)
211
+ txt_file.write(it.text)
205
212
  txt_file.write("\n")
206
213
  end
207
214
  end
@@ -1,3 +1,3 @@
1
1
  module EpubBook
2
- VERSION = "0.1.28"
2
+ VERSION = "0.1.31"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - qmliu
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.11'
39
+ version: '1.12'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.11.4
42
+ version: 1.12.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '1.11'
49
+ version: '1.12'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 1.11.4
52
+ version: 1.12.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: eeepub
55
55
  requirement: !ruby/object:Gem::Requirement