Sha256: 3ec8a768b37301d1a417d8951cae2058597373ea85f9b57d69c113ff23f542f4

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

require "youtube_search_thumbnail/version"
require 'open-uri'
require 'nokogiri'
require 'video_thumb'

module YoutubeSearchThumbnail


    def self.get(url, num=1, size="medium")
      result=[]
      url.delete!("^\u{0000}-\u{007F}")
      element = ".yt-lockup-title a"
      doc = Nokogiri::HTML(open(url))
      doc.css(element).each do |s|
        unless s.text.empty? then
          result<< "https://www.youtube.com#{s['href']}"
          # @songs.push(@stn.format_song(s.text.strip.sub(/^[0-9]./, '').titleize.strip))
        end
      end
      result[num-1]
      VideoThumb.get(result[num-1], size)
    end

    class Yst


      def get(url, num=1, size="medium")
        YoutubeSearchThumbnail::get(url,num,size)
      end


    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
youtube_search_thumbnail-0.1.4 lib/youtube_search_thumbnail.rb