# Allow users to embed video

**URL:** <https://www.ruby-forum.com/t/allow-users-to-embed-video/143012>\
**Category:** Rails\
**Created:** [July 14, 2008, 3:06pm UTC](https://www.ruby-forum.com/t/allow-users-to-embed-video/143012 "2008-07-14T15:06:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [July 14, 2008, 3:06pm UTC](https://www.ruby-forum.com/t/allow-users-to-embed-video/143012/1 "2008-07-14T15:06:21Z")

</div>

Hi - Anyone have any experience with safely allowing users to enter a  
YouTube or other such embed link safely into a form for later  
display? Is there a simple way to selective sanitize/escape and only  
allow embedded flash vids?

Thanks,  
Dino

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [July 14, 2008, 3:15pm UTC](https://www.ruby-forum.com/t/allow-users-to-embed-video/143012/2 "2008-07-14T15:15:09Z")

</div>

What about just allowing them to submit the URL - then you do the  
embedding by grepping out the video ID.

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [July 14, 2008, 4:59pm UTC](https://www.ruby-forum.com/t/allow-users-to-embed-video/143012/3 "2008-07-14T16:59:03Z")

</div>

Hi,

I actually supporting that on my site (not public yet).  
Users can enter the url and a description. Before displaying it I make  
sure the link points to youtube and that it is actually working. If so I  
allow it into the DB. I plan to add “report abuse” or something like  
that so others can comment if it is not appropriate.

I’m interested to know how others do it or would do it…

Cheers.

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [July 14, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/allow-users-to-embed-video/143012/4 "2008-07-14T18:26:02Z")

</div>

Good suggestions. The problem is, video web mostly have “embed” links,  
so I’d like to just go with the flow and allow embeds. But they  
strike me as super dangerous. But I guess this isn’t a Rails problem,  
everyone has to deal with dangerous embeds. I’ll post if I come up  
with a solution.

Thanks again,  
Dino

On Jul 14, 10:59 am, comopasta Gr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
