Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RESPONSE: This does not use HTTPS Sockets like I’d like, but the same issues arise despite their being a clear print.
- I have tried:
- """Gather proxies from the providers without
- checking and save them to a file."""
- import asyncio
- from proxybroker import Broker
- async def save(proxies, filename):
- """Save proxies to a file."""
- with open(filename, 'w') as f:
- while True:
- proxy = await proxies.get()
- if proxy is None:
- break
- f.write('%s:%d\n' % (proxy.host, proxy.port))
- def main():
- proxies = asyncio.Queue()
- broker = Broker(proxies)
- tasks = asyncio.gather(broker.grab(countries=['US', 'GB'], limit=1),
- save(proxies, filename='proxies511.txt'))
- loop = asyncio.get_event_loop()
- loop.run_until_complete(tasks)
- if __name__ == '__main__':
- main()
- with open('proxies511.txt', 'r') as f:
- first_line = f.readline()
- print(first_line)
- PROXY = " first_line" # IP:PORT or HOST:PORT
- #PROXY = " 35.187.234.217:80" # IP:PORT or HOST:PORT
- chrome_options = webdriver.ChromeOptions()
- chrome_options.add_argument('--proxy-server=%s' % PROXY)
- chrome = webdriver.Chrome(chrome_options=chrome_options)
- chrome.get("http://whatismyipaddress.com")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement