lib/dict/glosbe.rb in dict-0.3.6 vs lib/dict/glosbe.rb in dict-0.3.7

- old
+ new

@@ -24,11 +24,15 @@ private # checks if given word is polish def is_polish?(doc) - !doc.empty? && doc.at_css('.content_box_rounded p').nil? + return false if doc.empty? + s = doc.css("h1#phraseHeaderId small").text + return false if s.empty? + return false if s.include?("po angielsku") + true end # returns instance of Nokogiri::HTML module def get_content(url, word) begin @@ -40,10 +44,10 @@ # returns array with structure as shown below from the given dictionary link # ['TRANSLATION1', 'TRANSLATION2', ...] def get_translations(doc) translations = [] - doc.css('.phrase-container > .translation').each { |translation| translations.push(translation.text.downcase) } if !doc.empty? + doc.css("div#phraseTranslation ul li strong").each { |translation| translations.push(translation.text.downcase) } unless doc.empty? translations end # add obtained translations to Dict::Result object def add_translations(translations)