Class: FollowersNumber::Parsers::Instagram

Inherits:
Object
  • Object
show all
Defined in:
lib/followers_number/parsers/instagram.rb

Class Method Summary collapse

Class Method Details

.parse(html) ⇒ Object



4
5
6
7
8
# File 'lib/followers_number/parsers/instagram.rb', line 4

def self.parse(html)
  raw_json = html.to_s.match(/window\._sharedData =.*(?=;)/)
  json = ::JSON.parse(raw_json.to_s.gsub("window._sharedData = ", ""))
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["edge_followed_by"]["count"]
end