diff --git a/__pycache__/vevoxqa.cpython-39.pyc b/__pycache__/vevoxqa.cpython-39.pyc index 2e4a2f5..ea854cc 100644 Binary files a/__pycache__/vevoxqa.cpython-39.pyc and b/__pycache__/vevoxqa.cpython-39.pyc differ diff --git a/crush.py b/crush.py index 6f620f8..0606900 100644 --- a/crush.py +++ b/crush.py @@ -9,6 +9,8 @@ import vevoxqa from tqdm import tqdm +from random import randint +import time import sys from concurrent.futures import ThreadPoolExecutor, as_completed @@ -33,12 +35,18 @@ def main(): vq.close() elif cmdparts[0] == "upvote": - with tqdm(total=int(cmdparts[2]), bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') as pbar: - with ThreadPoolExecutor(max_workers=int(cmdparts[3])) as ex: + if len(cmdparts) < 4: + workers = 8 + else: + workers = int(cmdparts[3]) + + with tqdm(total=int(cmdparts[2]), bar_format='{l_bar}{bar:20}{r_bar}{bar:-20b}') as pbar: + with ThreadPoolExecutor(max_workers=workers) as ex: futures = [ex.submit(upvote, sessionid, cmdparts[1]) for i in range(int(cmdparts[2]))] for future in as_completed(futures): pbar.update(1) + elif cmdparts[0] == "questions": vq = vevoxqa.VevoxQA(sessionid) vq.connect() @@ -56,6 +64,7 @@ def upvote(sessionid, questionid): liker.connect() count = liker.likequestion(questionid) liker.close() + return count if __name__ == "__main__": diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d4adde5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +tqdm +requests +websocket-client