Module: RelatonIetf::Scrapper

Extended by:
Scrapper
Included in:
Scrapper
Defined in:
lib/relaton_ietf/scrapper.rb

Overview

Scrapper module

Constant Summary collapse

IDS =
"https://raw.githubusercontent.com/relaton/relaton-data-ids/main/"
RFC =
"https://raw.githubusercontent.com/relaton/relaton-data-rfcs/main/"
RSS =
"https://raw.githubusercontent.com/relaton/relaton-data-rfcsubseries/main/"
INDEX_FILE =
"index-v1.yaml"

Instance Method Summary collapse

Instance Method Details

#scrape_page(text) ⇒ RelatonIetf::IetfBibliographicItem

Parameters:

  • text (String)

Returns:



15
16
17
18
19
20
21
22
23
24
# File 'lib/relaton_ietf/scrapper.rb', line 15

def scrape_page(text)
  # Remove initial "IETF " string if specified
  ref = text.gsub(/^IETF /, "")
  # ref.sub!(/(?<=^(?:RFC|BCP|FYI|STD))\s(\d+)/) { $1.rjust 4, "0" }
  rfc_item ref
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
       Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
       Net::ProtocolError, SocketError
  raise RelatonBib::RequestError, "No document found for #{ref} reference"
end