Jul 20, 2017 05:36 AM
(This post was last modified: Jul 20, 2017 05:39 AM by vorticalbox.)
So i am creating a proxy scraper and I am trying to remove not working
so all the proxies are scraped and stored in list called proxies I then try open a webpage (this case facebook.com) using the proxy and then I want it to remove if it doesn't work.
The proxy list is map for speed.
but the length stays the same and nothing is removed, i've tried appends to a new list and that doesn't worth either.
so all the proxies are scraped and stored in list called proxies I then try open a webpage (this case facebook.com) using the proxy and then I want it to remove if it doesn't work.
The proxy list is map for speed.
Code
def proxyCheck(p):
global proxies
try:
session.get('https://facebook.com', proxies={'https' :p}, timeout=1)
except:
print "%s removed" % p
proxies.remove(p)
print "removing down proxies (%d)" % len(proxies)
p = Pool(cpu_count())
p.map(proxyCheck, proxies[:]) #[:] to make a copy, I read you can't remove as your iterarting
print "using %d" % len(proxies)¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

