Skip to content

Commit

Permalink
Update Facebook video embed code.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Jun 14, 2021
1 parent 90f78ab commit 301e82a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/initializers/05-string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def linkify_and_embed(request=nil, embed_only="")

def embed_html(request=nil)
root_url = request ? request.root_url : ""
if %r{^https?://www\.facebook\.com/.*/videos/(?:vb\.\d+\/)?(?<id>\d+)} =~ self || %r{^https?://www\.facebook\.com/video/embed\?video_id=(?<id>\d+)} =~ self
if %r{^https?://www\.facebook\.com/.*/videos/(?:vb\.\d+\/)?(?<id>\d+)} =~ self || %r{^https?://www\.facebook\.com/(?:watch/?v|video/embed\?video_id)=(?<id>\d+)} =~ self
# https://www.facebook.com/infectedmushroom/videos/454943357902682/
# https://www.facebook.com/watch/?v=454943357902682
<<~EOF
<iframe width="1280" height="720" src="https://www.facebook.com/video/embed?video_id=#{id}" frameborder="0" scrolling="no" allowfullscreen referrerpolicy="no-referrer"></iframe>
<a href="https://www.facebook.com/video/embed?video_id=#{id}" rel="noreferrer">Open embed</a>
Expand Down

0 comments on commit 301e82a

Please sign in to comment.