Last active
August 28, 2016 17:52
-
-
Save vtronko/7395c69ceb0e8087d100db8005abe88a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 json, requests, urllib | |
url = 'https://2ch.hk/api/captcha/2chaptcha/id' | |
imageurl = 'https://2ch.hk/api/captcha/2chaptcha/image/' | |
count = 100 | |
dirname = '/home/innermous/Downloads/' # leave this field empty to download into current directory | |
for x in range(0, count): | |
r = requests.get(url) | |
json_data = json.loads(r.text) | |
imagehash = json_data["id"] | |
src = imageurl + imagehash | |
filename = "{cat}captcha{num}.png".format(cat=dirname, num=x) | |
urllib.request.urlretrieve(src, filename) | |
print("Loaded {num} of {total}".format(num=x+1, total=count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment