Class: InstaScraper::HTML::Media

Inherits:
InstaScraper::HTML show all
Defined in:
lib/insta_scraper/html/media.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InstaScraper::HTML

#data, #html

Constructor Details

#initialize(code = nil, html = nil, params = {}) ⇒ Media

Returns a new instance of Media.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
# File 'lib/insta_scraper/html/media.rb', line 6

def initialize(code = nil, html = nil, params = {})
  raise ArgumentError, 'Provide a code or html string' if !code && !html

  @code = code
  @html = html
  @params = params
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/insta_scraper/html/media.rb', line 3

def code
  @code
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/insta_scraper/html/media.rb', line 3

def params
  @params
end

Instance Method Details

#urlObject



14
15
16
# File 'lib/insta_scraper/html/media.rb', line 14

def url
  "https://www.instagram.com/p/#{code}/#{serialize_params}"
end