Sha256: d4399318b9fdf7fec11a5cd455a9ed8b404aab06763696932946a2d4dc171d9f

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

module InstaScraper
  class HTML::Media < InstaScraper::HTML
    attr_reader :code

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

      @code = code
      @html = html
    end

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

    def data
      @data ||=
        Hashie::Mash.new(::JSON.parse(shared_data))
                    .extend(Hashie::Extensions::DeepFetch)
                    .extend(Hashie::Extensions::DeepFind)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
insta_scraper-0.3.0 lib/insta_scraper/html/media.rb
insta_scraper-0.2.0 lib/insta_scraper/html/media.rb