class YoutubeVideoInfo::Response
Attributes
raw_response[RW]
Public Class Methods
new(http_response, cgi_module)
click to toggle source
Calls superclass method
# File lib/youtube_video_info/response.rb, line 4 def initialize http_response, cgi_module @cgi_module = cgi_module super @cgi_module.parse(http_response) end
Public Instance Methods
links()
click to toggle source
# File lib/youtube_video_info/response.rb, line 14 def links @cgi_module.parse(self['url_encoded_fmt_stream_map'].first)['url'] end
links_by_itag()
click to toggle source
# File lib/youtube_video_info/response.rb, line 17 def links_by_itag parsed_links = {} list_of_links = links list_of_links.each do |link| parsed_link = @cgi_module.parse(link) itag = parsed_link['itag'].first parsed_links[itag] = link end parsed_links end
title()
click to toggle source
# File lib/youtube_video_info/response.rb, line 8 def title self['title'].first end
video_download_headers()
click to toggle source
# File lib/youtube_video_info/response.rb, line 27 def video_download_headers # This is just for convenience. # Many of these are here to make the request appear genuine. { "Connection" => "keep-alive", "Origin" => "https://www.youtube.com", "X-FirePHP-Version" => "0.0.6", "User-Agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.95 Safari/537.36", "Accept" => "*/*", "DNT" => "1", "Referer" => "https://www.youtube.com/watch?v=#{video_id[0]}", "Accept-Encoding" => "gzip, deflate, sdch", "Accept-Language" => "en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4" } end