Created
October 12, 2012 23:03
-
-
Save tskogberg/3882133 to your computer and use it in GitHub Desktop.
Slå upp ord i NE (www.ne.se)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slå upp ord i NE | |
require 'nokogiri' | |
require 'open-uri' | |
query_word = URI.encode('gamäng') | |
# alt doc.search('.ENC').text.lines.to_a[1].strip | |
doc = Nokogiri::HTML(open("http://www.ne.se/sok?q=#{query_word}")) | |
first_hit = doc.xpath('//span[@class="ENC"]').text.lines.map(&:strip)[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment