73 lines
1.8 KiB
Python
73 lines
1.8 KiB
Python
#!/bin/python
|
|
#
|
|
# crush.py
|
|
# VevoxCrusher
|
|
#
|
|
# Created by Yigit Colakoglu on 10/13/21.
|
|
# Copyright 2021. Yigit Colakoglu. All rights reserved.
|
|
#
|
|
|
|
import vevoxqa
|
|
from tqdm import tqdm
|
|
from random import randint
|
|
import time
|
|
import sys
|
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
|
|
|
|
def main():
|
|
print("====Welcome to Vevox Crusher====")
|
|
if len(sys.argv) < 2:
|
|
sessionid = input("Please enter session id: ")
|
|
else:
|
|
sessionid = sys.argv[1]
|
|
|
|
cmd = ""
|
|
|
|
while cmd != "exit":
|
|
cmd = input(">>> ")
|
|
cmdparts = cmd.split(" ")
|
|
|
|
if cmdparts[0] == "ask":
|
|
vq = vevoxqa.VevoxQA(sessionid)
|
|
vq.connect()
|
|
vq.askquestion(" ".join(cmdparts[1:]))
|
|
vq.close()
|
|
|
|
elif cmdparts[0] == "upvote":
|
|
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()
|
|
|
|
for i in vq.messages:
|
|
print("{} : {} [{} likes]".format(i["messageId"], i["text"], i["likesCount"]))
|
|
|
|
vq.close()
|
|
|
|
else:
|
|
print("Unknown comand >:(")
|
|
|
|
def upvote(sessionid, questionid):
|
|
liker = vevoxqa.VevoxQA(sessionid)
|
|
liker.connect()
|
|
count = liker.likequestion(questionid)
|
|
liker.close()
|
|
return count
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|