Sha256: e0fbbbd085e0026f2e6c2ee996b41d2991bd1eb06583bdc6cf16ca7a01d068c9

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

module Thumbnailer
  class VideoGoogle < Thumbnailer::Base
    def initialize(uri)
      begin
        params = CGI.parse(uri.query)
        doc = open("http://video.google.com/videofeed?docid=#{params['docid']}").read
#        @thumb_image = CGI.unescape(doc.scan(/thumbnailUrl\\x3d(.*?)\\x26/im)[0][0].gsub(/http:\/\/(\d+).*?/, "http://2"))
        doc = XML::Parser.string(doc).parse.find("//channel/item/media:group/media:thumbnail")

        @thumb_image = doc[0]['url']
        @small_thumb_image = @thumb_image
        @embed_url = "#{uri.scheme}://#{uri.host}/googleplayer.swf?docId=#{params['docid']}"
      rescue
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thumbnailer-ruby-0.1.2 lib/thumbnailer/sites/video_google.rb
thumbnailer-ruby-0.1.1 lib/thumbnailer/sites/video_google.rb
thumbnailer-ruby-0.1.0 lib/thumbnailer/sites/video_google.rb