Permalink
Browse files

Add embed_code for Vimeo and Youtube.

  • Loading branch information...
1 parent 1cf385a commit 67d1b12f2a20de3ab5e2cca9c6c838a36d3d9b4a @netmute netmute committed May 30, 2012
Showing with 6 additions and 2 deletions.
  1. +2 −1 lib/provider/vimeo.rb
  2. +2 −1 lib/provider/youtube.rb
  3. +2 −0 spec/video_info_spec.rb
View
@@ -1,5 +1,5 @@
class Vimeo
- attr_accessor :video_id, :embed_url, :url, :provider, :title, :description, :keywords,
+ attr_accessor :video_id, :embed_url, :embed_code, :url, :provider, :title, :description, :keywords,
:duration, :date, :width, :height,
:thumbnail_small, :thumbnail_large,
:view_count,
@@ -18,6 +18,7 @@ def get_info
@provider = "Vimeo"
@url = doc.search("url").inner_text
@embed_url = "http://player.vimeo.com/video/#{@video_id}"
+ @embed_code = "<iframe src=\"#{@embed_url}?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=0\" frameborder=\"0\"></iframe>"
@title = doc.search("title").inner_text
@description = doc.search("description").inner_text
@keywords = doc.search("tags").inner_text
View
@@ -1,5 +1,5 @@
class Youtube
- attr_accessor :video_id, :embed_url, :url, :provider, :title, :description, :keywords,
+ attr_accessor :video_id, :embed_url, :embed_code, :url, :provider, :title, :description, :keywords,
:duration, :date, :width, :height,
:thumbnail_small, :thumbnail_large,
:view_count,
@@ -28,6 +28,7 @@ def get_info
@provider = "YouTube"
@url = "http://www.youtube.com/watch?v=#{@video_id}"
@embed_url = "http://www.youtube.com/embed/#{@video_id}"
+ @embed_code = "<iframe src=\"#{@embed_url}\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe>"
@title = doc.search("media:title").inner_text
@description = doc.search("media:description").inner_text
@keywords = doc.search("media:keywords").inner_text
View
@@ -11,6 +11,7 @@
its(:video_id) { should == 'mZqGqE0D0n4' }
its(:url) { should == 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
its(:embed_url) { should == 'http://www.youtube.com/embed/mZqGqE0D0n4' }
+ its(:embed_code) { should == '<iframe src="http://www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
its(:title) { should == 'Cherry Bloom - King Of The Knife' }
its(:description) { should == 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
its(:keywords) { should == 'cherry, bloom, king, of, the, knife, guitar, drum, clip, rock, alternative, tremplin, Paris-Forum' }
@@ -69,6 +70,7 @@
its(:video_id) { should == '898029' }
its(:url) { should == 'http://vimeo.com/898029' }
its(:embed_url) { should == 'http://player.vimeo.com/video/898029' }
+ its(:embed_code) { should == '<iframe src="http://player.vimeo.com/video/898029?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=0" frameborder="0"></iframe>' }
its(:title) { should == 'Cherry Bloom - King Of The Knife' }
its(:description) { should == 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
its(:keywords) { should == 'cherry bloom, secret sounds, king of the knife, rock, alternative' }

0 comments on commit 67d1b12

Please sign in to comment.