Sha256: 81b072ce49d8c7e319289c980bf645ce8d4cd73452cc013b50aed05860a3486f

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

module Onebox
  module Engine
    class WikipediaOnebox
      include Engine
      include HTML

      matches do
        http
        anything
        domain("wikipedia")
        either(".com", ".org")
      end

      private

      def data
        {
          url: @url,
          name: raw.css("html body h1").inner_text,
          image: raw.css(".infobox .image img").first["src"],
          description: raw.css("html body p").inner_text
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onebox-1.1.0 lib/onebox/engine/wikipedia_onebox.rb