Class: VgMyspace
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 = {}) ⇒ VgMyspace
constructor
A new instance of VgMyspace.
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(url = nil, options = {}) ⇒ VgMyspace
Returns a new instance of VgMyspace.
9 10 11 12 13 14 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 9 def initialize(url=nil, ={}) @url = url @video_id = @url.query_param('videoid').blank? ? @url.query_param('VideoID') : @url.query_param('videoid') res = Net::HTTP.get(URI.parse("http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=#{@video_id}")) @feed = REXML::Document.new(res) end |
Instance Method Details
#download_url ⇒ Object
40 41 42 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 40 def download_url nil end |
#duration ⇒ Object
24 25 26 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 24 def duration nil end |
#embed_html(width = 425, height = 344, options = {}) ⇒ Object
32 33 34 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 32 def (width=425, height=344, ={}) "<embed src='#{}' type='application/x-shockwave-flash' width='#{width}' height='#{height}'></embed>" end |
#embed_url ⇒ Object
28 29 30 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 28 def "http://lads.myspace.com/videos/vplayer.swf?m=#{REXML::XPath.first( @feed, "//myspace:itemID" )[0]}&v=2&type=video" end |
#flv ⇒ Object
36 37 38 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 36 def flv REXML::XPath.first(@feed, "//media:content").attributes['url'] end |
#service ⇒ Object
44 45 46 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 44 def service "Myspace" end |
#thumbnail ⇒ Object
20 21 22 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 20 def thumbnail REXML::XPath.first(@feed, "//media:thumbnail").attributes['url'] end |
#title ⇒ Object
16 17 18 |
# File 'lib/acts_as_unvlogable/vg_myspace.rb', line 16 def title REXML::XPath.first(@feed, "//item/title")[0].to_s end |