Sha256: 9b0e684c127ecae416bb21ca06079bf262fc3852036f942ce89a9533d0d7f01e

Contents?: true

Size: 958 Bytes

Versions: 21

Compression:

Stored size: 958 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
      requires_iframe_origins "https://www.facebook.com"

      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

21 entries across 21 versions & 1 rubygems

Version Path
onebox-2.1.0 lib/onebox/engine/facebook_media_onebox.rb