fix formatting, spelling and linting
This commit is contained in:
parent
5fb93c6168
commit
4ad654929f
|
@ -98,4 +98,4 @@ response = ryd_client.post_votes(votes, user_id=user_id)
|
||||||
|
|
||||||
|
|
||||||
## Acknowledgement
|
## Acknowledgement
|
||||||
If you find this API usefull, please consider donating to the [project](https://returnyoutubedislike.com/donate).
|
If you find this API useful, please consider donating to the [project](https://returnyoutubedislike.com/donate).
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
"""post votes for YouTube video"""
|
"""api client for returnyoutubedislike.com"""
|
||||||
|
|
||||||
import random
|
|
||||||
import string
|
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
API_URL = "https://returnyoutubedislikeapi.com"
|
API_URL = "https://returnyoutubedislikeapi.com"
|
||||||
HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.1"}
|
HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.1"}
|
||||||
|
|
||||||
|
|
||||||
class Login:
|
class Login:
|
||||||
"""handle user registation"""
|
"""handle user registation"""
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ class Puzzle:
|
||||||
|
|
||||||
def solve(self):
|
def solve(self):
|
||||||
"""get puzzle solution"""
|
"""get puzzle solution"""
|
||||||
challenge = list(base64.b64decode(self.puzzle['challenge']))
|
challenge = list(base64.b64decode(self.puzzle["challenge"]))
|
||||||
max_count = 2 ** self.puzzle["difficulty"] * 5
|
max_count = 2 ** self.puzzle["difficulty"] * 5
|
||||||
# fill buffer
|
# fill buffer
|
||||||
buffer = bytearray(20)
|
buffer = bytearray(20)
|
||||||
|
@ -107,7 +108,7 @@ class Vote:
|
||||||
message = {
|
message = {
|
||||||
"id": self.video_id,
|
"id": self.video_id,
|
||||||
"status": response,
|
"status": response,
|
||||||
"vote": self.vote
|
"vote": self.vote,
|
||||||
}
|
}
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
@ -118,7 +119,7 @@ class Vote:
|
||||||
vote_map = {
|
vote_map = {
|
||||||
"like": 1,
|
"like": 1,
|
||||||
"dislike": -1,
|
"dislike": -1,
|
||||||
"neutral": 0
|
"neutral": 0,
|
||||||
}
|
}
|
||||||
if isinstance(vote, str):
|
if isinstance(vote, str):
|
||||||
try:
|
try:
|
||||||
|
@ -134,7 +135,7 @@ class Vote:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _initial_vote(self):
|
def _initial_vote(self):
|
||||||
"""send initial vote to recieve puzzle"""
|
"""send initial vote to receive puzzle"""
|
||||||
data = {
|
data = {
|
||||||
"userId": self.user_id,
|
"userId": self.user_id,
|
||||||
"videoId": self.video_id,
|
"videoId": self.video_id,
|
||||||
|
@ -154,7 +155,7 @@ class Vote:
|
||||||
data = {
|
data = {
|
||||||
"userId": self.user_id,
|
"userId": self.user_id,
|
||||||
"videoId": self.video_id,
|
"videoId": self.video_id,
|
||||||
"solution": solution["solution"]
|
"solution": solution["solution"],
|
||||||
}
|
}
|
||||||
url = f"{API_URL}/interact/confirmVote"
|
url = f"{API_URL}/interact/confirmVote"
|
||||||
response = requests.post(url, headers=HEADERS, json=data)
|
response = requests.post(url, headers=HEADERS, json=data)
|
||||||
|
@ -202,7 +203,7 @@ def get_votes(youtube_ids):
|
||||||
"status": votes.status_code,
|
"status": votes.status_code,
|
||||||
}
|
}
|
||||||
elif votes.status_code == 429:
|
elif votes.status_code == 429:
|
||||||
print("ratelimiting reached, cancle")
|
print("ratelimiting reached, cancel")
|
||||||
break
|
break
|
||||||
|
|
||||||
all_votes.append(parsed)
|
all_votes.append(parsed)
|
||||||
|
|
Loading…
Reference in New Issue