Last active
April 24, 2019 13:50
-
-
Save irdkwmnsb/e15337c3f5586748aa5c2bb28fa1f2ad to your computer and use it in GitHub Desktop.
РЕШУЕГЭ dumper
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 requests | |
| import re | |
| from tqdm import tqdm | |
| from multiprocessing import Pool | |
| import json | |
| import time | |
| s = None | |
| rex = re.compile(r"Задание (\d+) № ") | |
| r = range(12045105, 12140290) | |
| need = range(9, 15+1) | |
| u = r"https://rus-ege.sdamgia.ru/test?id={0}&print=true" | |
| def init(): | |
| global s | |
| s = requests.Session() | |
| def get(i): | |
| try: | |
| url = u.format(i) | |
| res = s.get(url) | |
| t = list(map(int, rex.findall(res.text))) | |
| return (i, t) | |
| except Exception as e: | |
| print("Атдыхатб") | |
| time.sleep(10) | |
| if __name__ == "__main__": | |
| with open("res.json", "w+") as f: | |
| print("[0,[]", file=f) | |
| with open("ok.txt", "w+") as ff: | |
| with open("ultraok.txt", "w+") as fff: | |
| a = [] | |
| with Pool(6, init) as p: | |
| print("start") | |
| for i, t in p.imap_unordered(get, tqdm(r), 5): | |
| if t and all([i in need for i in t]): | |
| if all([i in t for i in need]) and len(t) > len(need): | |
| print("!", end='') | |
| print("!", file=ff, end='') | |
| print(i, file=fff) | |
| print(i) | |
| fff.flush() | |
| print(i, file=ff) | |
| ff.flush() | |
| print(f", {i}, {repr(t)}", file=f) | |
| f.flush() | |
| print("]", file=f) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment