insta 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e7e426c1ee6c569d123ba4acbfcdced622f5680aa94cb19214fe0bcdbdcf23b
4
- data.tar.gz: 2a4efe486ca9f7fd9f3a9171f05c23bc6d3b002071630db4a49a3d7c9f64f279
3
+ metadata.gz: 6c18a2f951fdf5f6db5abbafe02d3e12dc7e1b5223160289dacc0fa11f8534a3
4
+ data.tar.gz: 0a88dff315f50a3ed3a9ef921eb763beabd032190711e577ada9987e4767b523
5
5
  SHA512:
6
- metadata.gz: 94965406d99a3e0b1261b4bb12b32bb1847ec9abd8df73e6ecf6d93fd8e20847260d16945d6cfda4ebf8773bcc63cab17e0611b49dfa320ba5a8723f7dd8ae98
7
- data.tar.gz: 86698e9907dadde9b05378c633c1caad70bffd49772baed130deb09a17eb74ad16a011dfdcbc3beb115e47b37b98d7fa65706a924d8d3d8f03d1a4c3b2971f75
6
+ metadata.gz: bb25813908172a37955af5a319bfa12ed9883db68d4561dbcb6c6917a2b480509d7707cdd46bfa65ec37d61d9dd22805caf77a442b1134e053ab2487610b43de
7
+ data.tar.gz: 04d0a38ab5c2127149405bc3ad49ef9cbc62efeb608ab53f0a787a6eb8e4c5b70d276ff4b5ea2640285ed474406bcc02cce0afab4f236164b11851de52f05cad
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- insta (0.2.4)
4
+ insta (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,7 +4,7 @@ module Insta
4
4
  user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
5
5
  rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
6
6
  endpoint = "https://i.instagram.com/api/v1/feed/user/#{user_id}/"
7
- proxys = ProxyManager.new data[:proxys] unless data[:proxys].nil?
7
+ proxys = Insta::ProxyManager.new data[:proxys] unless data[:proxys].nil?
8
8
  param = "?rank_token=#{rank_token}" +
9
9
  (!data[:max_id].nil? ? '&max_id=' + data[:max_id] : '')
10
10
  result = Insta::API.http(
@@ -20,7 +20,7 @@ module Insta
20
20
  def self.user_media_graphql(user, data)
21
21
  user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
22
22
  endpoint = "https://www.instagram.com/graphql/query/?query_id=17880160963012870&id=#{user_id}&first=80&after="
23
- proxys = ProxyManager.new data[:proxys] unless data[:proxys].nil?
23
+ proxys = Insta::ProxyManager.new data[:proxys] unless data[:proxys].nil?
24
24
  result = Insta::API.http(
25
25
  url: endpoint,
26
26
  method: 'GET',
@@ -36,7 +36,7 @@ module Insta
36
36
  has_next_page = true
37
37
  followers = []
38
38
  user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
39
- proxys = ProxyManager.new data[:proxys] unless data[:proxys].nil?
39
+ proxys = Insta::ProxyManager.new data[:proxys] unless data[:proxys].nil?
40
40
  data[:rank_token] = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
41
41
  while has_next_page && limit > followers.size
42
42
  response = user_followers_next_page(user, user_id, data, proxys)
@@ -51,7 +51,7 @@ module Insta
51
51
  has_next_page = true
52
52
  followers = []
53
53
  user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
54
- proxys = ProxyManager.new data[:proxys] unless data[:proxys].nil?
54
+ proxys = Insta::ProxyManager.new data[:proxys] unless data[:proxys].nil?
55
55
  while has_next_page && limit > followers.size
56
56
  response = user_followers_graphql_next_page(user, user_id, data, proxys)
57
57
  has_next_page = response['data']['user']['edge_followed_by']['page_info']['has_next_page']
@@ -1,21 +1,23 @@
1
1
  require 'securerandom'
2
2
 
3
- class ProxyManager
4
- attr_reader :proxys
5
- attr_writer :proxys
3
+ module Insta
4
+ class ProxyManager
5
+ attr_reader :proxys
6
+ attr_writer :proxys
6
7
 
7
- def initialize(proxys = [])
8
- proxys.each do |proxy|
9
- proxy[:id] = SecureRandom.uuid
10
- proxy[:last_use] = nil
8
+ def initialize(proxys = [])
9
+ proxys.each do |proxy|
10
+ proxy[:id] = SecureRandom.uuid
11
+ proxy[:last_use] = nil
12
+ end
13
+ @proxys = proxys
11
14
  end
12
- @proxys = proxys
13
- end
14
15
 
15
- def next
16
- return nil if @proxys.nil? || @proxys.empty?
17
- next_proxy = @proxys.sort_by { |proxy| proxy[:last_use] }.first
18
- next_proxy[:last_use] = Time.now
19
- next_proxy
16
+ def next
17
+ return nil if @proxys.nil? || @proxys.empty?
18
+ next_proxy = @proxys.sort_by { |proxy| proxy[:last_use] }.first
19
+ next_proxy[:last_use] = Time.now
20
+ next_proxy
21
+ end
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module Insta
2
- VERSION = '0.2.4'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renan Garcia