Class: Miteru::Feeds::UrlScan

Inherits:
Base show all
Defined in:
lib/miteru/feeds/urlscan.rb

Constant Summary

Constants inherited from Base

Base::IGNORE_EXTENSIONS

Instance Attribute Summary

Attributes inherited from Base

#base_url, #headers

Instance Method Summary collapse

Methods inherited from Base

#call, #decomposed_urls, inherited, #source

Methods inherited from Service

#call, call, #result, result

Constructor Details

#initialize(base_url = "https://urlscan.io") ⇒ UrlScan

Returns a new instance of UrlScan.

Parameters:

  • base_url (String) (defaults to: "https://urlscan.io")


9
10
11
12
13
# File 'lib/miteru/feeds/urlscan.rb', line 9

def initialize(base_url = "https://urlscan.io")
  super

  @headers = {"api-key": api_key}
end

Instance Method Details

#urlsObject



15
16
17
18
19
# File 'lib/miteru/feeds/urlscan.rb', line 15

def urls
  search_with_pagination.flat_map do |json|
    (json["results"] || []).map { |result| result.dig("task", "url") }
  end.uniq
end