Sha256: 7760bd10c10a643c3c386b2c79dbad8f0427db917f9a44e0c5bd527843b8efe7

Contents?: true

Size: 674 Bytes

Versions: 9

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

require "urlscan"

module Miteru
  class Feeds
    class UrlScanPro < Feed
      def api
        @api ||= ::UrlScan::API.new
      end

      def urls
        urls_from_pro_feed
      rescue ::UrlScan::ResponseError => e
        puts "Failed to load urlscan.io pro feed (#{e})"
        []
      end

      private

      def api_key?
        ENV.key? "URLSCAN_API_KEY"
      end

      def urls_from_pro_feed
        return [] unless api_key?

        res = api.pro.phishfeed
        results = res["results"] || []
        results.map { |result| result.dig("page_url") }
      rescue ArgumentError => _e
        []
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
miteru-0.14.7 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.6 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.5 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.4 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.3 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.2 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.1 lib/miteru/feeds/urlscan_pro.rb
miteru-0.14.0 lib/miteru/feeds/urlscan_pro.rb
miteru-0.13.0 lib/miteru/feeds/urlscan_pro.rb