Sha256: 6192cad859b5e0da25b439459fe2a7bab34ec06d9ac2513e2eb3ea008fc417d3
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
require 'cgi' class Muri module Filter module Vimeo VIMEO_VIDEO = "video" VIMEO_ALBUM = "album" def self.included(base) base.class_eval do self::PARSERS[Muri::Filter::Vimeo] = "vimeo_parse" end end def vimeo_parse @info[:service] = 'Vimeo' params = @url.query.nil? ? {} : CGI::parse(@url.query) if @url.path =~ /^\/(album\/)?([0-9]+)(\/)?$/i @info[:media_id] = $2 @info[:media_api_type] = $1.nil? ? VIMEO_VIDEO : VIMEO_ALBUM elsif @url.path =~ /^\/groups\/([0-9a-z\@\-\_]+)\/videos\/([0-9]+)(\/)?$/i @info[:media_id] = $2 @info[:media_api_type] = VIMEO_VIDEO elsif ((@url.path =~ /^\/moogaloop\.swf/i) && (params.include?("clip_id"))) @info[:media_id] = params["clip_id"].first if (params["clip_id"].first =~ /([0-9]+)/) @info[:media_api_type] = VIMEO_VIDEO end if self.valid? @info[:media_api_id] = @info[:media_id] album = (@info[:media_api_type] == VIMEO_ALBUM) ? "album/" : "" @info[:website] = "http://vimeo.com/#{album}#{@info[:media_id]}" else raise UnsupportedURI end self end def self.parsable?(uri) uri.host =~ /^vimeo\.com$/i end end end end # http://www.vimeo.com/groups/beyondthestill/videos/9394829 # http://vimeo.com/moogaloop.swf?clip_id=7312128&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" # http://vimeo.com/7312128 # http://vimeo.com/album/89702
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
muri-0.0.9 | lib/muri/filters/vimeo.rb |
muri-0.0.8 | lib/muri/filters/vimeo.rb |
muri-0.0.7 | lib/muri/filters/vimeo.rb |
muri-0.0.6 | lib/muri/filters/vimeo.rb |