Module: RelatonIso::Scrapper
- Defined in:
- lib/relaton_iso/scrapper.rb
Overview
Scrapper. rubocop:disable Metrics/ModuleLength
Constant Summary collapse
- DOMAIN =
"https://www.iso.org"- TYPES =
{ "TS" => "technical-specification", "TR" => "technical-report", "PAS" => "publicly-available-specification", # "AWI" => "approvedWorkItem", # "CD" => "committeeDraft", # "FDIS" => "finalDraftInternationalStandard", # "NP" => "newProposal", # "DIS" => "draftInternationalStandard", # "WD" => "workingDraft", # "R" => "recommendation", "Guide" => "guide", }.freeze
Class Method Summary collapse
-
.parse_page(hit_data) ⇒ Hash
Parse page.
Class Method Details
.parse_page(hit_data) ⇒ Hash
Parse page. rubocop:disable Metrics/AbcSize, Metrics/MethodLength
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/relaton_iso/scrapper.rb', line 48 def parse_page(hit_data) path = "/contents/data/standard#{hit_data["splitPath"]}/#{hit_data["csnumber"]}.html" doc, url = get_page path # Fetch edition. edition = doc&.xpath("//strong[contains(text(), 'Edition')]/..")&. children&.last&.text&.match(/\d+/)&.to_s titles, abstract = fetch_titles_abstract(doc) RelatonIsoBib::IsoBibliographicItem.new( fetched: Date.today.to_s, docid: fetch_docid(doc), edition: edition, language: langs(doc).map { |l| l[:lang] }, script: langs(doc).map { |l| script(l[:lang]) }.uniq, title: titles, type: fetch_type(hit_data["docRef"]), docstatus: fetch_status(doc), ics: fetch_ics(doc), date: fetch_dates(doc, hit_data["docRef"]), contributor: fetch_contributors(hit_data["docRef"]), editorialgroup: fetch_workgroup(doc), abstract: abstract, copyright: fetch_copyright(hit_data["docRef"], doc), link: fetch_link(doc, url), relation: fetch_relations(doc), structuredidentifier: fetch_structuredidentifier(doc), ) end |