Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Get A Bible Passage From The Living Stones / Seek-First Web Service With Ruby

DZone's Guide to

Get A Bible Passage From The Living Stones / Seek-First Web Service With Ruby

·
Free Resource

require 'net/http'

LS_BASE_URL = 'http://www.seek-first.com/Bible.php?q=&passage=Seek'

def lookup_ls(reference, translation) # living stones (KJV, ASV, YLT, AKJV, WEB)
  return if reference.nil? or reference.empty?
  url = LS_BASE_URL + '&p=' + URI.escape(reference) + '&version=' + translation
  result = Net::HTTP.get(URI.parse(url))
  url = /
  /.match(result)[1]
  result = Net::HTTP.get(URI.parse(url)).gsub(/\s+/, ' ').gsub(/“|�/, '"').gsub(/‘|’/, "'").gsub('*', '')
  text = result.scan(/
  
   (.+?)<\/Text>/).map { |p| p[0].strip.gsub(/<.+?>/, '') }.join(' ') rescue nil
  return {:reference => reference, :text => text}
end

  
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}