Module: RfcBib::Scrapper
- Defined in:
- lib/rfcbib/scrapper.rb
Overview
Scrapper module
Class Method Summary collapse
Class Method Details
.scrape_page(text) ⇒ IsoBibItem::BibliographicItem
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rfcbib/scrapper.rb', line 15 def scrape_page(text) ref = text.sub(' ', '.') + '.xml' if text =~ /^RFC/ uri = URI("https://www.rfc-editor.org/refs/bibxml/reference.#{ref}") elsif text =~ /^I-D/ uri = URI("https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ids/reference.#{ref}") end doc = Nokogiri::HTML Net::HTTP.get(uri) @reference = doc.at('//reference') return unless @reference bib_item end |