Class: SocialNet::Instagram::Api::ScrapeUserVideosRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/social_net/instagram/api/scrape_user_videos_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ ScrapeUserVideosRequest

Returns a new instance of ScrapeUserVideosRequest.



11
12
13
14
15
# File 'lib/social_net/instagram/api/scrape_user_videos_request.rb', line 11

def initialize(attrs = {})
  @host = 'www.instagram.com'
  @path = attrs.fetch :path, "/#{attrs[:username]}/"
  @method = attrs.fetch :method, :get
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/social_net/instagram/api/scrape_user_videos_request.rb', line 17

def run
  print "#{as_curl}\n"
  case response = run_http_request
  when Net::HTTPOK
    data_string = Nokogiri::HTML response.body
    parse_video_data data_string
  else
    raise Errors::ResponseError, response
  end
end