iciba 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iciba/fanyi.rb +3 -1
- data/lib/iciba/version.rb +1 -1
- metadata +1 -1
data/lib/iciba/fanyi.rb
CHANGED
@@ -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
|
data/lib/iciba/version.rb
CHANGED