insta 0.2.7 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/insta.gemspec +1 -1
- data/lib/insta/account.rb +33 -0
- data/lib/insta/api.rb +2 -0
- data/lib/insta/location.rb +18 -0
- data/lib/insta/proxy_manager.rb +1 -1
- data/lib/insta/tag.rb +18 -0
- data/lib/insta/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b07de8bff823379e8c5fb024fe5fc7031ddb716dc17d7b25c415da4d532ed175
|
4
|
+
data.tar.gz: 7a0ce471f26ebc75b0d912f2cbfc955b49aa473aac90b6f420058d56140af8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61fc6c96f446b11fe57bf462621dfbf5cbe5af26cf4d4847c8f282310188429694809c30851fe6a4f08e3d720a12dcaa1b36361416e541ff376438ad8a9b9f7
|
7
|
+
data.tar.gz: cf0a4f61c2617d1a3501e1ccb8082cca119eaf2c059fa9cbea08e61b563a2bae0d540a92700bcba01d259dd1ef398b0729e2d02f4223cea03399f3b9dedfca3c
|
data/Gemfile.lock
CHANGED
data/insta.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = 'Welcome to Insta(pre-alpha) gem! This Gem is hard fork from vicoerv/instagram-private-api and the implement from huttarichard/instagram-private-api'
|
13
13
|
spec.description = spec.summary
|
14
|
-
spec.homepage = '
|
14
|
+
spec.homepage = 'https://github.com/renan-garcia/insta'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
data/lib/insta/account.rb
CHANGED
@@ -61,6 +61,39 @@ module Insta
|
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
+
def self.by_id(user, profile_id, data)
|
65
|
+
rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
|
66
|
+
endpoint = "https://i.instagram.com/api/v1/users/#{profile_id}/info/"
|
67
|
+
proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
|
68
|
+
param = format('?is_typehead=true&rank_token=%s', rank_token)
|
69
|
+
result = Insta::API.http(
|
70
|
+
url: endpoint + param,
|
71
|
+
method: 'GET',
|
72
|
+
user: user,
|
73
|
+
proxy: proxies&.next
|
74
|
+
)
|
75
|
+
|
76
|
+
response = JSON.parse result.body, symbolize_names: true
|
77
|
+
|
78
|
+
return nil unless response[:user].any?
|
79
|
+
{
|
80
|
+
profile_id: response[:user][:id],
|
81
|
+
external_url: response[:user][:external_url],
|
82
|
+
followers: response[:user][:follower_count],
|
83
|
+
following: response[:user][:following_count],
|
84
|
+
full_name: response[:user][:full_name],
|
85
|
+
avatar_url: response[:user][:hd_profile_pic_url_info][:url],
|
86
|
+
avatar_url_hd: response[:user][:hd_profile_pic_url_info][:url],
|
87
|
+
username: response[:user][:username],
|
88
|
+
biography: response[:user][:biography],
|
89
|
+
verified: response[:user][:is_verified],
|
90
|
+
medias_count: response[:user][:media_count],
|
91
|
+
is_private: response[:user][:is_private],
|
92
|
+
phone: response[:user][:contact_phone_number],
|
93
|
+
email: response[:user][:public_email]
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
64
97
|
def self.search_for_user(user, username, data)
|
65
98
|
rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
|
66
99
|
endpoint = 'https://i.instagram.com/api/v1/users/search/'
|
data/lib/insta/api.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Insta
|
2
|
+
module Location
|
3
|
+
def self.by_id(user, location_id, data)
|
4
|
+
user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
|
5
|
+
rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
|
6
|
+
endpoint = %Q[https://www.instagram.com/graphql/query/?query_id=17865274345132052&variables={"id":"#{location_id}","first":42,"after":"#{data.dig(:end_cursor)}"}]
|
7
|
+
proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
|
8
|
+
result = Insta::API.http(
|
9
|
+
url: endpoint,
|
10
|
+
method: 'GET',
|
11
|
+
user: user,
|
12
|
+
proxy: proxies&.next
|
13
|
+
)
|
14
|
+
|
15
|
+
JSON.parse result.body
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/insta/proxy_manager.rb
CHANGED
data/lib/insta/tag.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Insta
|
2
|
+
module Tag
|
3
|
+
def self.find(user, tag, data)
|
4
|
+
user_id = (!data[:id].nil? ? data[:id] : user.data[:id])
|
5
|
+
rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
|
6
|
+
endpoint = %Q[https://www.instagram.com/graphql/query/?query_id=17875800862117404&variables={"tag_name":"#{tag}","first":42,"after":"#{data.dig(:end_cursor)}"}]
|
7
|
+
proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
|
8
|
+
result = Insta::API.http(
|
9
|
+
url: endpoint,
|
10
|
+
method: 'GET',
|
11
|
+
user: user,
|
12
|
+
proxy: proxies&.next
|
13
|
+
)
|
14
|
+
|
15
|
+
JSON.parse result.body
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/insta/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renan Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,10 +81,12 @@ files:
|
|
81
81
|
- lib/insta/constants.rb
|
82
82
|
- lib/insta/device.rb
|
83
83
|
- lib/insta/feed.rb
|
84
|
+
- lib/insta/location.rb
|
84
85
|
- lib/insta/proxy_manager.rb
|
86
|
+
- lib/insta/tag.rb
|
85
87
|
- lib/insta/user.rb
|
86
88
|
- lib/insta/version.rb
|
87
|
-
homepage:
|
89
|
+
homepage: https://github.com/renan-garcia/insta
|
88
90
|
licenses:
|
89
91
|
- MIT
|
90
92
|
metadata:
|