lib/twitterscraper/proxy.rb in twitterscraper-ruby-0.11.0 vs lib/twitterscraper/proxy.rb in twitterscraper-ruby-0.12.0

- old
+ new

@@ -15,19 +15,21 @@ def sample if @cur_index >= @items.size reload end @cur_index += 1 - item = @items[@cur_index - 1] - Twitterscraper.logger.info("Using proxy #{item}") - item + @items[@cur_index - 1] end def size @items.size end + def empty? + @items.empty? + end + private def reload @items = Proxy.get_proxies @cur_index = 0 @@ -49,10 +51,9 @@ next unless ['elite proxy', 'anonymous'].include?(anonymity) next if https == 'no' proxies << ip + ':' + port end - Twitterscraper.logger.debug "Fetch #{proxies.size} proxies" proxies.shuffle rescue => e if (retries -= 1) > 0 retry else