Created
September 13, 2011 21:35
-
-
Save ramayac/1215235 to your computer and use it in GitHub Desktop.
Obtiene un cachimbo de imagenes con el captcha de Digicel.
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
import time | |
from urllib import urlopen | |
from urllib import urlretrieve | |
import os | |
import sys | |
import hashlib | |
from threading import Thread | |
class worker(Thread): | |
out_folder = os.path.abspath(os.curdir) + "/test" | |
hashing = hashlib.sha1() | |
def run(self): | |
while True: | |
url = "http://actualiza.digicel.com.sv/captcha.ashx" | |
worker.hashing.update(str(time.time())) | |
filename = "captcha" + worker.hashing.hexdigest()[:10] + ".png" | |
outpath = os.path.join(worker.out_folder, filename) | |
urlretrieve(url, outpath) | |
time.sleep(1) | |
if __name__ == "__main__": | |
worker().start() | |
worker().start() | |
worker().start() | |
worker().start() | |
worker().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment