Sha256: 8aa4829ceba5a1a3c970d323158269136ea0983dbc6e2f3e8639e1ca6b4d0ab9

Contents?: true

Size: 476 Bytes

Versions: 2

Compression:

Stored size: 476 Bytes

Contents

module Onebox
  module Engine
    class WikipediaOnebox
      include Engine
      include HTML

      matches do
        # /^https?:\/\/.*wikipedia\.(com|org)\/.*$/
        find "wikipedia.com"
      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

2 entries across 2 versions & 1 rubygems

Version Path
onebox-1.0.1 lib/onebox/engine/wikipedia_onebox.rb
onebox-1.0.0 lib/onebox/engine/wikipedia_onebox.rb