Skip to content

Instantly share code, notes, and snippets.

@hirokai
Created March 18, 2016 05:18
Show Gist options
  • Save hirokai/8e2de9b9c76ebd2cafcb to your computer and use it in GitHub Desktop.
Save hirokai/8e2de9b9c76ebd2cafcb to your computer and use it in GitHub Desktop.
Wikipediaからジャーナルの省略名を取得するRubyスクリプト

Wikipediaからジャーナルの省略名を取得するRubyスクリプト

require 'open-uri'
require 'openssl'
require 'nokogiri'

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

title = "European Journal of Pharmaceutical Sciences"
url = "https://en.wikipedia.org/wiki/#{title.gsub(' ','_')}"

open(url){|f|
  str = f.read
  doc = Nokogiri::HTML.parse(str)
  puts doc.css('table.infobox > tr')[1].css('td').inner_text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment