class Hawker::Drivers::Instagram

Public Instance Methods

biography() click to toggle source

The current user biography

@return [String]

# File lib/hawker/drivers/instagram.rb, line 10
def biography
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["biography"]
end
external_url() click to toggle source

The current user external URL that is present in the biography

@return [String]

# File lib/hawker/drivers/instagram.rb, line 38
def external_url
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["external_url"]
end
followers() click to toggle source

The current user followers count

@return [Integer]

# File lib/hawker/drivers/instagram.rb, line 24
def followers
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["edge_followed_by"]["count"]
end
following() click to toggle source

The number of accounts that the current user follows

@return [Integer]

# File lib/hawker/drivers/instagram.rb, line 31
def following
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["edge_follow"]["count"]
end
full_name() click to toggle source

The current user full name

@return [String]

# File lib/hawker/drivers/instagram.rb, line 17
def full_name
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["full_name"]
end
profile_pic_url() click to toggle source

The current user profile picture URL

@return [String]

# File lib/hawker/drivers/instagram.rb, line 45
def profile_pic_url
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["profile_pic_url"]
end
username() click to toggle source

The current user Instagram username

@return [String]

# File lib/hawker/drivers/instagram.rb, line 52
def username
  json["entry_data"]["ProfilePage"].first["graphql"]["user"]["username"]
end

Private Instance Methods

json() click to toggle source
# File lib/hawker/drivers/instagram.rb, line 58
def json
  @json ||= begin
    raw_json = html.to_s.match(/window\._sharedData =.*(?=;)/)
    JSON.parse(raw_json.to_s.gsub("window._sharedData = ", ""))
  end
end