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

author() click to toggle source
# File lib/youtube_video_info/response.rb, line 11
def author
  self['author'].first
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