Class: Scrapio::Resources::YouTube

Inherits:
Object
  • Object
show all
Defined in:
lib/scrapio/resources/youtube.rb

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ YouTube

Returns a new instance of YouTube.



4
# File 'lib/scrapio/resources/youtube.rb', line 4

def initialize(http) = @http = http

Instance Method Details

#get_channel(handle, limit: nil) ⇒ Object



21
22
23
# File 'lib/scrapio/resources/youtube.rb', line 21

def get_channel(handle, limit: nil)
  @http.get("/v1/youtube/channel", { handle: handle, limit: limit })
end

#get_subtitles(video_id, language: nil) ⇒ Object



17
18
19
# File 'lib/scrapio/resources/youtube.rb', line 17

def get_subtitles(video_id, language: nil)
  @http.get("/v1/youtube/subtitles", { video_id: video_id, language: language })
end

#get_video(video_id) ⇒ Object



6
7
8
# File 'lib/scrapio/resources/youtube.rb', line 6

def get_video(video_id)
  @http.get("/v1/youtube/videos/#{URI.encode_uri_component(video_id)}")
end

#search(search, start_page: nil, end_page: nil, country: nil, language: nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/scrapio/resources/youtube.rb', line 10

def search(search, start_page: nil, end_page: nil, country: nil, language: nil)
  @http.get("/v1/youtube/search", {
    search: search, start_page: start_page, end_page: end_page,
    country: country, language: language,
  })
end