diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-14 09:40:52 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-14 09:40:52 -0500 |
| commit | 3833366756e384454642585faa5e036f33d2f41b (patch) | |
| tree | af79fa5d229703bf76e0d0cd7619562ee6033f5d | |
| parent | 3cdaceccd0088aaafb68e26c73c4c84d0732ef68 (diff) | |
| download | invidious-3833366756e384454642585faa5e036f33d2f41b.tar.gz invidious-3833366756e384454642585faa5e036f33d2f41b.tar.bz2 invidious-3833366756e384454642585faa5e036f33d2f41b.zip | |
Change options to provide more proxies
| -rw-r--r-- | src/invidious/helpers/proxy.cr | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/invidious/helpers/proxy.cr b/src/invidious/helpers/proxy.cr index 3e94042d..fc59941e 100644 --- a/src/invidious/helpers/proxy.cr +++ b/src/invidious/helpers/proxy.cr @@ -98,26 +98,28 @@ def get_proxies(country_code = "US") headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" headers["Accept-Language"] = "Accept-Language: en-US,en;q=0.9" headers["Host"] = "spys.one" + headers["Origin"] = "http://spys.one" + headers["Referer"] = "http://spys.one/free-proxy-list/#{country_code}/" headers["Content-Type"] = "application/x-www-form-urlencoded" body = { "xpp" => "2", "xf1" => "0", - "xf2" => "2", - "xf4" => "1", + "xf2" => "0", + "xf4" => "2", "xf5" => "1", } response = client.post("/free-proxy-list/#{country_code}/", headers, form: body) response = XML.parse_html(response.body) proxies = [] of {ip: String, port: Int32, score: Float64} - response = response.xpath_nodes(%q(//table))[1] + response = response.xpath_node(%q(//tr/td/table)).not_nil! response.xpath_nodes(%q(.//tr)).each do |node| if !node["onmouseover"]? next end ip = node.xpath_node(%q(.//td[1]/font[2])).to_s.match(/<font class="spy14">(?<address>[^<]+)</).not_nil!["address"] - port = 3128 + port = 8080 latency = node.xpath_node(%q(.//td[6])).not_nil!.content.to_f speed = node.xpath_node(%q(.//td[7]/font/table)).not_nil!["width"].to_f |
