iciba 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,9 @@ module Iciba
45
45
  def download_and_parse(words, dir, extended)
46
46
  self.response = Iciba::Tools.parse(Iciba::Tools.post('http://fy.iciba.com/api.php', {:q => words, :type => dir}).body_str)
47
47
  self.html = self.response.ret.encode("UTF-8")
48
- self.result = (Iciba::Tools.doc(self.html)/'div.translate_result').text.strip
48
+ self.result = (Iciba::Tools.doc(self.html)/'div.translate_result').text.strip if self.html.include?('translate_result')
49
+ self.result = (Iciba::Tools.doc(self.html)/'span.dd').text.strip if !self.html.include?('translate_result')
50
+
49
51
  self.result = self.html if self.result == ""
50
52
  self.result = self.result.split(',')[0] if self.result.include?(',') unless extended
51
53
  self.result = self.result.split(';')[0] if self.result.include?(';') unless extended
@@ -1,3 +1,3 @@
1
1
  module Iciba
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iciba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: