mirror of
https://github.com/JimenezJC/discord-7tv-emoji-app.git
synced 2025-12-05 23:39:55 -05:00
added support for more sizes + smoother gifs
This commit is contained in:
parent
ce79e80f2a
commit
8e7789d4b5
2 changed files with 33 additions and 49 deletions
25
seventv.py
25
seventv.py
|
|
@ -3,25 +3,28 @@ import requests
|
|||
|
||||
def get_webp_url(url):
|
||||
emote_id = url[23:]
|
||||
api_call = ('https://7tv.io/v3/emotes/' + emote_id)
|
||||
api_call = "https://7tv.io/v3/emotes/" + emote_id
|
||||
response = requests.get(api_call).json()
|
||||
|
||||
image_url = response["host"]["url"]
|
||||
max_name = ""
|
||||
max_size = 262144
|
||||
|
||||
image_url = response['host']['url']
|
||||
for file in response['host']['files']:
|
||||
if file['width'] == 128 and file['name'][3:] == 'webp':
|
||||
return ('https:' + image_url + '/' + file['name'])
|
||||
for file in response["host"]["files"]:
|
||||
if (
|
||||
file["width"] <= 128 and file["height"] <= 128 and file["size"] <= max_size
|
||||
) and file["name"][3:] == "webp":
|
||||
max_name = file["name"]
|
||||
|
||||
print(max_size)
|
||||
return "https:" + image_url + "/" + max_name
|
||||
|
||||
return ('No 128x128 file detected')
|
||||
|
||||
def get_emote_name(url):
|
||||
emote_id = url[23:]
|
||||
api_call = ('https://7tv.io/v3/emotes/' + emote_id)
|
||||
api_call = "https://7tv.io/v3/emotes/" + emote_id
|
||||
response = requests.get(api_call).json()
|
||||
|
||||
emote_name = response['name']
|
||||
emote_name = response["name"]
|
||||
|
||||
return emote_name
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue