Compare commits
3 Commits
709d1dea65
...
6c5185c59d
Author | SHA1 | Date |
---|---|---|
simon | 6c5185c59d | |
simon | f131507dd3 | |
simon | a3dc0d5c07 |
2
build.sh
2
build.sh
|
@ -45,7 +45,7 @@ function publish {
|
||||||
python -m build
|
python -m build
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
git tag -a "$VERSION" -m "new release version $VERSION"
|
git tag -a "$VERSION" -m "new release version $VERSION"
|
||||||
git push "$VERSION"
|
git push origin "$VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == "publish" ]]; then
|
if [[ $1 == "publish" ]]; then
|
||||||
|
|
|
@ -9,7 +9,7 @@ from time import sleep
|
||||||
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.5"}
|
HEADERS = {"User-Agent": "https://github.com/bbilly1/ryd-client v0.0.6"}
|
||||||
|
|
||||||
|
|
||||||
class Login:
|
class Login:
|
||||||
|
@ -218,13 +218,14 @@ class VoteGet:
|
||||||
def _get_vote(youtube_id):
|
def _get_vote(youtube_id):
|
||||||
"""get vote from a single video"""
|
"""get vote from a single video"""
|
||||||
url = f"{API_URL}/votes?videoId={youtube_id}"
|
url = f"{API_URL}/votes?videoId={youtube_id}"
|
||||||
|
votes = None
|
||||||
try:
|
try:
|
||||||
votes = requests.get(url, headers=HEADERS, timeout=3)
|
votes = requests.get(url, headers=HEADERS, timeout=3)
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
sleep(5)
|
sleep(5)
|
||||||
votes = requests.get(url, headers=HEADERS, timeout=5)
|
votes = requests.get(url, headers=HEADERS, timeout=5)
|
||||||
|
|
||||||
if not votes:
|
if votes is None:
|
||||||
raise ConnectionError("failed to connect to API")
|
raise ConnectionError("failed to connect to API")
|
||||||
|
|
||||||
if votes.ok:
|
if votes.ok:
|
||||||
|
@ -232,7 +233,7 @@ class VoteGet:
|
||||||
parsed["status"] = votes.status_code
|
parsed["status"] = votes.status_code
|
||||||
del parsed["dateCreated"]
|
del parsed["dateCreated"]
|
||||||
else:
|
else:
|
||||||
print(f"{youtube_id}: API returns error code {votes.status_code}.")
|
print(f"{youtube_id}: RYD returns error code {votes.status_code}.")
|
||||||
parsed = {
|
parsed = {
|
||||||
"id": youtube_id,
|
"id": youtube_id,
|
||||||
"status": votes.status_code,
|
"status": votes.status_code,
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="ryd-client",
|
name="ryd-client",
|
||||||
version="0.0.5",
|
version="0.0.6",
|
||||||
author="Simon",
|
author="Simon",
|
||||||
author_email="simobilleter@gmail.com",
|
author_email="simobilleter@gmail.com",
|
||||||
description="api client for returnyoutubedislike.com",
|
description="api client for returnyoutubedislike.com",
|
||||||
|
|
Loading…
Reference in New Issue