Try to speed up find_working_proxies

This commit is contained in:
Omar Roth
2018-10-03 10:38:07 -05:00
parent f83e9e6eb9
commit 3830604e42
4 changed files with 51 additions and 41 deletions

View File

@@ -543,6 +543,10 @@ def fetch_video(id, proxies)
proxies.each do |region, list|
spawn do
info = HTTP::Params.new({
"reason" => [info["reason"]],
})
list.each do |proxy|
begin
client = HTTPClient.new(YT_URL)
@@ -563,6 +567,11 @@ def fetch_video(id, proxies)
rescue ex
end
end
# If none of the proxies we tried returned a valid response
if info["reason"]?
bypass_channel.send(nil)
end
end
end