class Instagram::User
Attributes
config[RW]
data[RW]
language[R]
password[R]
session[RW]
username[R]
Public Class Methods
new(username, password, session = nil, data = nil, config = nil)
click to toggle source
# File lib/Instagram/user.rb, line 17 def initialize(username, password, session = nil, data = nil, config = nil) @username = username @password = password @language = 'en_US' @session = session @data = data @config = config @account = nil @feed = nil end
Public Instance Methods
account()
click to toggle source
# File lib/Instagram/user.rb, line 52 def account @account = Instagram::Account.new if @account.nil? @account end
api()
click to toggle source
# File lib/Instagram/user.rb, line 72 def api (18 + (md5int % 5)).to_s end
device_id()
click to toggle source
# File lib/Instagram/user.rb, line 114 def device_id 'android-' + md5[0..15] end
dpi()
click to toggle source
# File lib/Instagram/user.rb, line 81 def dpi %w[801 577 576 538 515 424 401 373][md5int % 8] end
feed()
click to toggle source
# File lib/Instagram/user.rb, line 58 def feed @feed = Instagram::Feed.new if @feed.nil? @feed.using(self) end
followers(limit = Float::INFINITY, data = {})
click to toggle source
# File lib/Instagram/user.rb, line 36 def followers(limit = Float::INFINITY, data = {}) Instagram::Feed.user_followers(self, data, limit) end
info()
click to toggle source
# File lib/Instagram/user.rb, line 90 def info line = Device.devices[md5int % Device.devices.count] { manufacturer: line[0], device: line[1], model: line[2] } end
md5()
click to toggle source
# File lib/Instagram/user.rb, line 64 def md5 Digest::MD5.hexdigest @username end
md5int()
click to toggle source
# File lib/Instagram/user.rb, line 68 def md5int (md5.to_i(32) / 10e32).round end
relationship()
click to toggle source
# File lib/Instagram/user.rb, line 44 def relationship unless instance_variable_defined? :@relationship @relationship = Relationship.new self end @relationship end
release()
click to toggle source
@return [string]
# File lib/Instagram/user.rb, line 77 def release %w[4.0.4 4.3.1 4.4.4 5.1.1 6.0.1][md5int % 5] end
resolution()
click to toggle source
# File lib/Instagram/user.rb, line 85 def resolution %w[3840x2160 1440x2560 2560x1440 1440x2560 2560x1440 1080x1920 1080x1920 1080x1920][md5int % 8] end
search_for_user(username)
click to toggle source
# File lib/Instagram/user.rb, line 28 def search_for_user(username) account.search_for_user(self, username) end
search_for_user_graphql(username)
click to toggle source
# File lib/Instagram/user.rb, line 32 def search_for_user_graphql(username) account.search_for_graphql(self, username) end
user_followers_graphql(limit = Float::INFINITY, data = {})
click to toggle source
# File lib/Instagram/user.rb, line 40 def user_followers_graphql(limit = Float::INFINITY, data = {}) Instagram::Feed.user_followers_graphql(self, data, limit) end
useragent()
click to toggle source
# File lib/Instagram/user.rb, line 110 def useragent format('Instagram %s Android(%s)', useragent_hash[:version], useragent_hash[:agent].rstrip) end
useragent_hash()
click to toggle source
# File lib/Instagram/user.rb, line 99 def useragent_hash agent = [api + '/' + release, dpi + 'dpi', resolution, info[:manufacturer], info[:model], info[:device], @language] { agent: agent.join('; '), version: CONSTANTS::PRIVATE_KEY[:APP_VERSION] } end