Permalink
Browse files

new snotr.com plugin

  • Loading branch information...
1 parent 8319223 commit 42647aec4a3c571ce50fc16018d076d43b905089 @4poc 4poc committed Jan 22, 2013
Showing with 32 additions and 0 deletions.
  1. +32 −0 lib/remote/plugins/snotr.rb
@@ -0,0 +1,32 @@
+
+class Snotr < Plugin
+ TYPE = 'video'
+ PATTERN = %r{http[s]?://(www\.)?(snotr\.com/video/\d+)}
+
+ def filename
+ return self.title.gsub(/[^a-zA-Z0-9_\-\.]/, '')
+ end
+
+ def url # return url to preview image
+ search_one('link[@rel="image_src"]/@href') || super
+ end
+
+ def title
+ og_search 'title'
+ end
+
+ def embed
+ <<snotr
+ <iframe src="http://www.snotr.com/embed/#{video_id}"
+ width="400" height="330" frameborder="0"></iframe>
+snotr
+ end
+
+ private
+
+ def video_id
+ @orig_url.match %r{video/(\d+)}
+ return $1
+ end
+end
+

0 comments on commit 42647ae

Please sign in to comment.