requestmanager 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requestmanager.rb +7 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2f086333239d7760bc0a03208dc59e95441157d
4
- data.tar.gz: 80395cfd0b14ba82b054aca39201dc0803e0ace0
3
+ metadata.gz: 645f7dba1280414c132469b9d356d5e5602f8d64
4
+ data.tar.gz: 3df9c3f96f9741a58d63afba68832ee86acb1e22
5
5
  SHA512:
6
- metadata.gz: 4f26a8610101114f05f1836b0eb7db30206c76d78f78310d564e5333903ea64ece43ac256db3312dd2ffaba17c540509d34ef37197ba79e13a328a19771d9f74
7
- data.tar.gz: 6e447bb1fec1444e5cdb3a0986eff9d074b8e3fe30344f9f255805183865eaa8f2617caf150213747a1c3405222bd58bb882d7ef141767b738e77f430044f51e
6
+ metadata.gz: 5e73423eb94aa754bfe12029568e804ff01c87ebd9aab2d4405ce329cbc34af3f84aef05c6704796b4ef68897a9dd9910ccfe93294e7f75933a83e929d086d31
7
+ data.tar.gz: 3cc826b71d251e842dbb98ab27440a6412773b57c2dd49463feed15d04f3256ac86b090b18c3b41743550ef767ea74c7a2c717249a51e2291821d9988f2badea
@@ -26,6 +26,11 @@ class RequestManager
26
26
  @browsers[chosen_proxy] = [gen_driver(chosen_proxy), Time.now]
27
27
  end
28
28
 
29
+ # Get the html on the page now
30
+ def get_updated_current_page
31
+ return get_most_recent_browser[1][0].page_source
32
+ end
33
+
29
34
  # Get the most recently used browser
30
35
  def get_most_recent_browser
31
36
  most_recent = @browsers.first
@@ -111,8 +116,7 @@ class RequestManager
111
116
  # Choose a random proxy that hasn't been used recently
112
117
  def get_random_proxy
113
118
  max = @proxy_list.length
114
- chosen = @proxy_list[Random.rand(max)]
115
- chosen_proxy = chosen[0]+":"+chosen[1]
119
+ chosen_proxy = @proxy_list[Random.rand(max)]
116
120
 
117
121
  # Only use proxy if it hasn't been used in last n seconds on same host
118
122
  if !@used_proxies.include?(chosen_proxy)
@@ -127,7 +131,7 @@ class RequestManager
127
131
  # Parse the proxy list
128
132
  def parse_proxy_list(proxy_file)
129
133
  if proxy_file
130
- return IO.readlines(proxy_file).map{ |proxy| proxy.strip.split(":")}
134
+ return IO.readlines(proxy_file).map{ |proxy| proxy.strip }
131
135
  end
132
136
  end
133
137
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requestmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. C. McGrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Manages proxies, wait intervals, etc
14
14
  email: shidash@shidash.com