From 4ad654929fd2409a17d98504f93d2ee0d4d02d81 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 29 Dec 2021 17:41:14 +0700 Subject: [PATCH] fix formatting, spelling and linting --- README.md | 2 +- ryd-client/ryd_client.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bdb5baa..03f570a 100644 --- a/README.md +++ b/README.md @@ -98,4 +98,4 @@ response = ryd_client.post_votes(votes, user_id=user_id) ## 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). diff --git a/ryd-client/ryd_client.py b/ryd-client/ryd_client.py index c4d9639..895211d 100644 --- a/ryd-client/ryd_client.py +++ b/ryd-client/ryd_client.py @@ -1,15 +1,16 @@ -"""post votes for YouTube video""" +"""api client for returnyoutubedislike.com""" -import random -import string import base64 import hashlib +import random +import string import requests API_URL = "https://returnyoutubedislikeapi.com" HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.1"} + class Login: """handle user registation""" @@ -69,7 +70,7 @@ class Puzzle: def solve(self): """get puzzle solution""" - challenge = list(base64.b64decode(self.puzzle['challenge'])) + challenge = list(base64.b64decode(self.puzzle["challenge"])) max_count = 2 ** self.puzzle["difficulty"] * 5 # fill buffer buffer = bytearray(20) @@ -107,7 +108,7 @@ class Vote: message = { "id": self.video_id, "status": response, - "vote": self.vote + "vote": self.vote, } return message @@ -118,7 +119,7 @@ class Vote: vote_map = { "like": 1, "dislike": -1, - "neutral": 0 + "neutral": 0, } if isinstance(vote, str): try: @@ -134,7 +135,7 @@ class Vote: return False def _initial_vote(self): - """send initial vote to recieve puzzle""" + """send initial vote to receive puzzle""" data = { "userId": self.user_id, "videoId": self.video_id, @@ -154,7 +155,7 @@ class Vote: data = { "userId": self.user_id, "videoId": self.video_id, - "solution": solution["solution"] + "solution": solution["solution"], } url = f"{API_URL}/interact/confirmVote" response = requests.post(url, headers=HEADERS, json=data) @@ -202,7 +203,7 @@ def get_votes(youtube_ids): "status": votes.status_code, } elif votes.status_code == 429: - print("ratelimiting reached, cancle") + print("ratelimiting reached, cancel") break all_votes.append(parsed)