Class: VgQik
Instance Method Summary collapse
- #download_url ⇒ Object
- #duration ⇒ Object
- #embed_html(width = 425, height = 344, options = {}) ⇒ Object
- #embed_url ⇒ Object
- #flv ⇒ Object
-
#initialize(url = nil, options = {}) ⇒ VgQik
constructor
A new instance of VgQik.
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(url = nil, options = {}) ⇒ VgQik
Returns a new instance of VgQik.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 9 def initialize(url=nil, ={}) @url = url @video_id = parse_url(url) @page = Hpricot(open("http://qik.com/video/#{@video_id}")) emb = @page.search('//input[@value^="<object"]').first.attributes['value'] tx = Hpricot(emb) @feed_url = CGI::parse(tx.search('//embed').first.attributes['flashvars'].to_s)["rssURL"].to_s res = Net::HTTP.get(URI::parse(@feed_url)) @feed = REXML::Document.new(res) end |
Instance Method Details
#download_url ⇒ Object
40 41 42 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 40 def download_url nil end |
#duration ⇒ Object
44 45 46 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 44 def duration nil end |
#embed_html(width = 425, height = 344, options = {}) ⇒ Object
32 33 34 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 32 def (width=425, height=344, ={}) "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='#{width}' height='#{height}' id='qikPlayer' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='true' /><param name='movie' value='#{}' /><param name='quality' value='high' /><param name='bgcolor' value='#333333' /><embed src='#{}' quality='high' bgcolor='#333333' width='#{width}' height='#{height}' name='qikPlayer' align='middle' allowScriptAccess='sameDomain' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/></object>" end |
#embed_url ⇒ Object
28 29 30 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 28 def "http://qik.com/swfs/qikPlayer4.swf?rssURL=#{@feed_url}&autoPlay=false" end |
#flv ⇒ Object
36 37 38 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 36 def flv REXML::XPath.first(@feed, "//item/media:content[@type='video/x-flv']").attributes['url'] end |
#service ⇒ Object
48 49 50 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 48 def service "Qik" end |
#thumbnail ⇒ Object
24 25 26 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 24 def thumbnail REXML::XPath.first(@feed, "//item/media:thumbnail").attributes['url'] end |
#title ⇒ Object
20 21 22 |
# File 'lib/acts_as_unvlogable/vg_qik.rb', line 20 def title REXML::XPath.first(@feed, "//item/title")[0].to_s end |