lib/relaton_ieee/hit_collection.rb in relaton-ieee-1.10.0 vs lib/relaton_ieee/hit_collection.rb in relaton-ieee-1.10.1

- old
+ new

@@ -19,13 +19,10 @@ url = "#{DOMAIN}/wp-admin/admin-ajax.php" query = reference.gsub("/", " ") resp = Faraday.post url, { action: "ieee_cloudsearch", q: query } json = JSON.parse resp.body html = Nokogiri::HTML json["html"] - # @array = json["results"]["hits"]["hit"].reduce([]) do |s, hit| @array = html.xpath("//h4/a").reduce([]) do |s, hit| - # fields = hit["fields"] - # ref = html.at("//h4/a[@href='#{fields['doc_id_l']}']").text.strip ref = hit.text.strip /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ ref next s unless code2 && code1 =~ %r{^#{code2}} hit_data = { ref: ref, year: year.to_i, url: hit[:href] }