requestmanager 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/requestmanager.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 645f7dba1280414c132469b9d356d5e5602f8d64
|
4
|
+
data.tar.gz: 3df9c3f96f9741a58d63afba68832ee86acb1e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e73423eb94aa754bfe12029568e804ff01c87ebd9aab2d4405ce329cbc34af3f84aef05c6704796b4ef68897a9dd9910ccfe93294e7f75933a83e929d086d31
|
7
|
+
data.tar.gz: 3cc826b71d251e842dbb98ab27440a6412773b57c2dd49463feed15d04f3256ac86b090b18c3b41743550ef767ea74c7a2c717249a51e2291821d9988f2badea
|
data/lib/requestmanager.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
+
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
|
+
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
|