insta 0.2.0 → 0.2.1

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: cb0902f06fda365ec8d0840171b83223d93bfe159ff0412930ca024e2cbfa540
4
- data.tar.gz: 7deb412d4ef0dd34b866812fc9f88f73ba02267392d37e7231f0d3abda01c4ce
3
+ metadata.gz: da70366ba8d65dcdc2083d3409fa0b8e30c5f819dc4f6f6a934ba0cbb52ef618
4
+ data.tar.gz: cbe39575d60c95d609c4cb58ef364f5a1bb6e402ccbce97c1be9b9f9638fe91a
5
5
  SHA512:
6
- metadata.gz: 587d32f2e1b6b4ccde90f21bfaadec33060456ddf8ee88e31b5aea302bc91e19c5a08a1d98a473eb1906a84b8042723274f26fe67a37dbbaaf53f813d677826c
7
- data.tar.gz: 2f9ca51871d3d99de02b9f348bdd4862dcd402808195e28fb4347b51f87ce461ba307f0a9fe96d122b56686f34e28b7c4e819e4cff2b625166fa4552ad8b7acb
6
+ metadata.gz: e17ccdb7aa662006c666abff601d10034ce68172efb9635bc71098f4b4dc97e80782b04d3d3df312e9a3f16efb175597fcfc55c5301a4c808ed59b74d1676174
7
+ data.tar.gz: 8e7bb62ac211ec5c79395c5ef0af06dddc8d7640de439942d1538ce91dd6ae1f2dd58ba3348b7aad7c373e32c692f3d13218d8840d07e928ea46a37b67816b65
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- insta (0.2.0)
4
+ insta (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Insta
1
+ # Insta (Pre-Alpha)
2
2
 
3
3
  Welcome to Insta gem! This Gem is hard fork from [VicoErv/instagram-private-api](https://github.com/VicoErv/instagram-private-api) and the implement from [huttarichard/instagram-private-api](https://github.com/huttarichard/instagram-private-api) the best `Node-JS` Insgtagram private API
4
4
 
@@ -36,9 +36,31 @@ module Insta
36
36
  compute_hash(data) + '.' + data
37
37
  end
38
38
 
39
+ def self.http_desktop(args)
40
+ args[:url] = URI.parse(args[:url])
41
+ proxy = args.dig(:proxys)&.sample || {}
42
+ http = Net::HTTP.new(args[:url].host, args[:url].port, proxy.dig(:host), proxy.dig(:port))
43
+ http.use_ssl = true
44
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
45
+ request = nil
46
+ if args[:method] == 'POST'
47
+ request = Net::HTTP::Post.new(args[:url].path)
48
+ elsif args[:method] == 'GET'
49
+ request = Net::HTTP::Get.new(args[:url].path + (!args[:url].nil? ? '?' + args[:url].query : ''))
50
+ end
51
+
52
+ request.initialize_http_header(:'User-Agent' => Insta::CONSTANTS::HEADER[:user_agent_desktop],
53
+ :Accept => Insta::CONSTANTS::HEADER[:accept],
54
+ :Cookie => (args.dig(:user)&.session.nil? ? '' : args.dig(:user)&.session))
55
+
56
+ request.body = args.key?(:body) ? args[:body] : nil
57
+ http.request(request)
58
+ end
59
+
39
60
  def self.http(args)
40
61
  args[:url] = URI.parse(args[:url])
41
- http = Net::HTTP.new(args[:url].host, args[:url].port, ENV['INSTAGRAM_PROXY_HOST'], ENV['INSTAGRAM_PROXY_PORT'])
62
+ proxy = args[:proxys].sample
63
+ http = Net::HTTP.new(args[:url].host, args[:url].port, proxy.dig(:host), proxy.dig(:port))
42
64
  http.use_ssl = true
43
65
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
44
66
  request = nil
@@ -7,12 +7,13 @@ module Insta
7
7
  }.freeze
8
8
 
9
9
  HEADER = {
10
- capabilities: '3QI='.freeze,
11
- type: 'WIFI'.freeze,
12
- host: 'i.instagram.com'.freeze,
13
- connection: 'Close'.freeze,
14
- encoding: 'gzip, deflate, sdch'.freeze,
15
- accept: '*/*'.freeze
10
+ user_agent_desktop: 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'.freeze,
11
+ capabilities: '3QI='.freeze,
12
+ type: 'WIFI'.freeze,
13
+ host: 'i.instagram.com'.freeze,
14
+ connection: 'Close'.freeze,
15
+ encoding: 'gzip, deflate, sdch'.freeze,
16
+ accept: '*/*'.freeze
16
17
  }
17
18
 
18
19
  URL = 'https://i.instagram.com/api/v1/'.freeze
@@ -1,3 +1,3 @@
1
1
  module Insta
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
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.0
4
+ version: 0.2.1
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-12 00:00:00.000000000 Z
11
+ date: 2018-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler