Sha256: e8a065cafccf94d1831879305e234d5620f4740bdbd3124f5d5a10d84444f3d8

Contents?: true

Size: 901 Bytes

Versions: 3

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class FacebookMediaOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/.*\.facebook\.com\/(\w+)\/(videos|\?).*/)
      always_https

      def to_html
        metadata = get_twitter
        if metadata.present? && metadata[:card] == "player" && metadata[:player].present?
          <<-HTML
            <iframe src="#{metadata[:player]}"
                    width="#{metadata[:player_width]}"
                    height="#{metadata[:player_height]}"
                    scrolling="no"
                    frameborder="0"
                    allowfullscreen>
            </iframe>
          HTML
        else
          html = Onebox::Engine::AllowlistedGenericOnebox.new(@url, @timeout).to_html
          return if Onebox::Helpers.blank?(html)
          html
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
onebox-2.0.2 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.0.1 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.0.0 lib/onebox/engine/facebook_media_onebox.rb