Sha256: bfdfa5c3c16b428d6a974286f4dfedde08a3a35acdcbc620a9a6935e43a949cd

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require "json"
require "uri"

module Miteru
  class Feeds
    class Ayashige < Feed
      HOST = "ayashige.herokuapp.com"
      URL = "https://#{HOST}/"

      def urls
        url = url_for("/feed")
        res = JSON.parse(get(url))

        domains = res.map { |item| item["domain"]}
        domains.map do |domain|
          [
            "https://#{domain}",
            "http://#{domain}"
          ]
        end.flatten
      rescue HTTPResponseError => e
        puts "Failed to load ayashige feed (#{e})"
        []
      end

      private

      def url_for(path)
        URI(URL + path)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
miteru-0.11.0 lib/miteru/feeds/ayashige.rb