Sli.do 按讚機器人

. . . .
.

這個腳本可以自動點讚 sli.do 的特定留言

Run : python3 ./slido.py https://app.sli.do/event/wcuhtjpd/live/questions 43648908

image1

import requests
import time
import json
import sys
import threading
from threading import Event

exit = Event()

def job(thread_idx):
    for i in range(10):

        # INPUT
        ids = sys.argv[1].split('/')[4]
        qid = sys.argv[2]

        # START
        session_requests = requests.Session()
        session_requests.cookies.clear()

        # ID
        id_res = session_requests.get(
            "https://app.sli.do/api/v0.5/events?hash=" + ids)
        uuid = json.loads(id_res.text)[0]['uuid']

        # AUTH
        auth_res = session_requests.post(
            "https://app.sli.do/api/v0.5/events/" + uuid + "/auth")

        time.sleep(2)

        # LIKE
        like_headers = {
            "authorization": "Bearer " + str(auth_res.text[17:57]),
            "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
        }

        post = session_requests.post("https://app.sli.do/api/v0.5/events/" + uuid +
                                     "/questions/" + qid + "/like", data='{"score":1}', headers=like_headers)

        print("New score: " + str(post.status_code))

        session_requests.close()
        time.sleep(60)
    print(str(thread_idx) + "is done.")

# 建立 5 個子執行緒
threads = []
for i in range(5):
    threads.append(threading.Thread(target=job, args=(i,)))
    threads[i].start()

# 等待所有子執行緒結束
for i in range(5):
    threads[i].join()

print("Done.")


Tags: Cool