Created
August 11, 2017 14:42
-
-
Save miklevin/2e76b75398b68ede5a17b8d4783ab951 to your computer and use it in GitHub Desktop.
Takes a text file of web proxies and makes sure you round-robin between C-blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxies = [] | |
with open('goodproxies.txt', 'r') as f: | |
for line in f: | |
proxies.append(line.strip()) | |
block_dict = dict() | |
blocks = set() | |
staggered = [] | |
for proxy in proxies: | |
block = '.'.join(proxy.split('.')[:3]) | |
block_dict[proxy] = block | |
blocks.add(block) | |
staggered = [] | |
while proxies: | |
for block in blocks: | |
for index, test_next in enumerate(proxies): | |
next_block = '.'.join(test_next.split('.')[:3]) | |
if block == next_block: | |
staggered.append(test_next) | |
del proxies[index] | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment