Skip to content

Instantly share code, notes, and snippets.

@joinemm
Created April 27, 2023 12:23
Show Gist options
  • Save joinemm/36f64ece1f8db8a59eb2f024a038acd7 to your computer and use it in GitHub Desktop.
Save joinemm/36f64ece1f8db8a59eb2f024a038acd7 to your computer and use it in GitHub Desktop.
Loonacord commands Imgur conversion
import json
from time import sleep
import requests
with open("loonacord_imgur_commands.json", "rb") as f:
commands_raw = json.load(f)
for command in commands_raw:
sleep(1)
name = command["command"]
link = command["text"]
if not link.startswith("https://"):
print("command", name, "has bad url:", link)
continue
with open("images/" + link.split("/")[-1], "wb") as f:
f.write(requests.get(link).content)
import json
import requests
with open("loonacord_imgur_commands.json", "rb") as f:
commands_raw = json.load(f)
reuploaded_commands = []
rejects = []
APIKEY = ""
URL = "https://lensdump.com/api/1/upload"
HEADERS = {"X-API-Key": APIKEY}
for command in commands_raw:
name = command["command"]
link = command["text"]
try:
print("Uploading", name)
with open("images/" + link.split("/")[-1], "rb") as f:
r = requests.post(
URL,
data={
"album_id": "ExWOT",
"title": name,
},
headers=HEADERS,
files={"source": f},
)
new_image_url = r.json()["image"]["url"]
reuploaded_commands.append({"command": name, "text": new_image_url})
except Exception as e:
print("FAILED", e)
rejects.append(command)
with open("new_commands.json", "w") as f:
f.write(json.dumps(reuploaded_commands))
with open("rejected.json", "w") as f:
f.write(json.dumps(rejects))
[
{
"command": "2jinantifa",
"text": "https://i2.lensdump.com/i/EkBmPq.png"
},
{
"command": "2jinwave",
"text": "https://i.lensdump.com/i/EkB3jA.gif"
},
{
"command": "420",
"text": "https://i3.lensdump.com/i/EkB4dM.jpeg"
},
{
"command": "911",
"text": "https://i1.lensdump.com/i/EkBKMQ.jpeg"
},
{
"command": "anappleaday",
"text": "https://i.lensdump.com/i/EkBpaa.gif"
},
{
"command": "bald",
"text": "https://i3.lensdump.com/i/EkBO6e.jpeg"
},
{
"command": "banhammer",
"text": "https://i.lensdump.com/i/EkBHzk.gif"
},
{
"command": "banseul",
"text": "https://i1.lensdump.com/i/EkBlbx.jpeg"
},
{
"command": "bbc",
"text": "https://i.lensdump.com/i/EkBStH.png"
},
{
"command": "bbc2",
"text": "https://i2.lensdump.com/i/EkBeK1.png"
},
{
"command": "callmebaby",
"text": "https://i1.lensdump.com/i/EkBnPc.png"
},
{
"command": "choerryaha",
"text": "https://i2.lensdump.com/i/EkBLjK.jpeg"
},
{
"command": "choerryconfused",
"text": "https://i1.lensdump.com/i/EkBMqZ.gif"
},
{
"command": "choerryhappi",
"text": "https://i3.lensdump.com/i/EkBYMP.gif"
},
{
"command": "choerryheh",
"text": "https://i1.lensdump.com/i/EkBohm.jpeg"
},
{
"command": "choerryhwaiting",
"text": "https://i.lensdump.com/i/EkBDCi.gif"
},
{
"command": "choerrypositivity",
"text": "https://i2.lensdump.com/i/EkBPw9.jpeg"
},
{
"command": "choerrypositivity2",
"text": "https://i.lensdump.com/i/EkBUKv.jpeg"
},
{
"command": "christiancord",
"text": "https://i2.lensdump.com/i/EkBbj5.jpeg"
},
{
"command": "chuucard",
"text": "https://i.lensdump.com/i/EkBxYT.jpeg"
},
{
"command": "chuuchair",
"text": "https://i3.lensdump.com/i/EkBGC7.jpeg"
},
{
"command": "chuudone",
"text": "https://i1.lensdump.com/i/EkBaSr.jpeg"
},
{
"command": "chuufu",
"text": "https://i.lensdump.com/i/EkBhwF.jpeg"
},
{
"command": "chuupunks",
"text": "https://i2.lensdump.com/i/EkmAp0.png"
},
{
"command": "chuusadsong",
"text": "https://i.lensdump.com/i/EkmWfD.jpeg"
},
{
"command": "chuuwave",
"text": "https://i2.lensdump.com/i/Ekmj0q.gif"
},
{
"command": "creativeblock",
"text": "https://i.lensdump.com/i/Ekm0BA.jpeg"
},
{
"command": "dead",
"text": "https://i2.lensdump.com/i/EkmIYM.png"
},
{
"command": "delayed",
"text": "https://i.lensdump.com/i/Ekmg2Q.jpeg"
},
{
"command": "delete",
"text": "https://i2.lensdump.com/i/EkmrCa.jpeg"
},
{
"command": "disappointed",
"text": "https://i.lensdump.com/i/EkmtSe.jpeg"
},
{
"command": "djchuu",
"text": "https://i3.lensdump.com/i/Ekm1xk.jpeg"
},
{
"command": "eatcherry",
"text": "https://i1.lensdump.com/i/EkmT1x.gif"
},
{
"command": "expecting",
"text": "https://i.lensdump.com/i/EkmEpH.jpeg"
},
{
"command": "fakesurprised",
"text": "https://i2.lensdump.com/i/EkmkF1.jpeg"
},
{
"command": "fastestrapper",
"text": "https://i1.lensdump.com/i/EkmC0c.png"
},
{
"command": "feelsheartjin",
"text": "https://i2.lensdump.com/i/EkmJBK.png"
},
{
"command": "feelsloonajin",
"text": "https://i3.lensdump.com/i/EkmQoZ.png"
},
{
"command": "feelsyeojin",
"text": "https://i2.lensdump.com/i/Ekm92P.png"
},
{
"command": "feelsyeojin2",
"text": "https://i.lensdump.com/i/EkmdJm.jpeg"
},
{
"command": "flop",
"text": "https://i3.lensdump.com/i/Ekmqei.jpeg"
},
{
"command": "flop2",
"text": "https://i1.lensdump.com/i/EkmBxo.jpeg"
},
{
"command": "gowongun",
"text": "https://i3.lensdump.com/i/EkmsR9.jpeg"
},
{
"command": "gowonscalp",
"text": "https://i2.lensdump.com/i/Ekm372.png"
},
{
"command": "hair",
"text": "https://i.lensdump.com/i/Ekm4Fv.jpeg"
},
{
"command": "hairflip",
"text": "https://i1.lensdump.com/i/EkmpIC.jpeg"
},
{
"command": "hairflip2",
"text": "https://i.lensdump.com/i/Ekm7B5.gif"
},
{
"command": "haseulmath",
"text": "https://i3.lensdump.com/i/EkmOoz.jpeg"
},
{
"command": "haseulsigh",
"text": "https://i1.lensdump.com/i/Ekml8T.gif"
},
{
"command": "haseulwand",
"text": "https://i3.lensdump.com/i/EkmzJb.gif"
},
{
"command": "haseulwink",
"text": "https://i1.lensdump.com/i/EkmSe7.gif"
},
{
"command": "haseulwtf",
"text": "https://i.lensdump.com/i/Ekmeyr.gif"
},
{
"command": "heartattack",
"text": "https://i2.lensdump.com/i/EkmvRF.gif"
},
{
"command": "heejinflower",
"text": "https://i1.lensdump.com/i/EkmL73.gif"
},
{
"command": "heejingj",
"text": "https://i3.lensdump.com/i/EkmMU0.gif"
},
{
"command": "heejinnod",
"text": "https://i2.lensdump.com/i/EkmoID.gif"
},
{
"command": "heejinsad",
"text": "https://i1.lensdump.com/i/Ekmumq.gif"
},
{
"command": "heejinshrug",
"text": "https://i3.lensdump.com/i/EkmDuA.jpeg"
},
{
"command": "heejinsleep",
"text": "https://i.lensdump.com/i/EkmP8M.gif"
},
{
"command": "hhyunjin",
"text": "https://i2.lensdump.com/i/EkmfQQ.jpeg"
},
{
"command": "hihigh",
"text": "https://i.lensdump.com/i/EkmUye.gif"
},
{
"command": "hoodunnies",
"text": "https://i2.lensdump.com/i/Ekmb7x.jpeg"
},
{
"command": "hoodyeojin",
"text": "https://i.lensdump.com/i/EkmyZ1.png"
},
{
"command": "hyunjindorito",
"text": "https://i2.lensdump.com/i/EkmGuK.jpeg"
},
{
"command": "hyunjingun",
"text": "https://i1.lensdump.com/i/Eks2QP.gif"
},
{
"command": "hyunjinheart2",
"text": "https://i2.lensdump.com/i/EksA5i.gif"
},
{
"command": "hyunjinrap",
"text": "https://i3.lensdump.com/i/EksjO9.gif"
},
{
"command": "hyunjinthrow",
"text": "https://i2.lensdump.com/i/EksZZv.gif"
},
{
"command": "hyunjinunamused",
"text": "https://i.lensdump.com/i/Eksru5.png"
},
{
"command": "hyunjinwink",
"text": "https://i1.lensdump.com/i/EksRVT.gif"
},
{
"command": "hyunjinwink2",
"text": "https://i.lensdump.com/i/EksE57.gif"
},
{
"command": "hyunthumbsup",
"text": "https://i2.lensdump.com/i/EksCOF.gif"
},
{
"command": "ihokse",
"text": "https://i3.lensdump.com/i/EksVg0.png"
},
{
"command": "imouttahere",
"text": "https://i1.lensdump.com/i/EksdDq.gif"
},
{
"command": "jinshocked",
"text": "https://i.lensdump.com/i/EksBWA.jpeg"
},
{
"command": "jinsoulblanket",
"text": "https://i2.lensdump.com/i/EksmVM.png"
},
{
"command": "jinsoulfunny",
"text": "https://i.lensdump.com/i/EkssvQ.gif"
},
{
"command": "jinsoulhi",
"text": "https://i2.lensdump.com/i/Eks35a.gif"
},
{
"command": "jinsoulmath2",
"text": "https://i.lensdump.com/i/EksKEe.jpeg"
},
{
"command": "jinsoulpoggers",
"text": "https://i2.lensdump.com/i/EkspHk.jpeg"
},
{
"command": "juice",
"text": "https://i.lensdump.com/i/Eks7cx.jpeg"
},
{
"command": "justno",
"text": "https://i2.lensdump.com/i/EksHgH.png"
},
{
"command": "kimlipd",
"text": "https://i3.lensdump.com/i/Eksl31.png"
},
{
"command": "kimlipomg",
"text": "https://i2.lensdump.com/i/EkszDc.jpeg"
},
{
"command": "kimlipscared",
"text": "https://i3.lensdump.com/i/EkseWK.jpeg"
},
{
"command": "lipsoulwave",
"text": "https://i.lensdump.com/i/Eksn9Z.gif"
},
{
"command": "loonahour",
"text": "https://i2.lensdump.com/i/EksvvP.jpeg"
},
{
"command": "mocking",
"text": "https://i1.lensdump.com/i/EksLGm.gif"
},
{
"command": "newfastestrapper",
"text": "https://i3.lensdump.com/i/EksYki.jpeg"
},
{
"command": "noakgae",
"text": "https://i2.lensdump.com/i/EksoHo.png"
},
{
"command": "nodeer2",
"text": "https://i.lensdump.com/i/EksuX9.png"
},
{
"command": "nohug",
"text": "https://i3.lensdump.com/i/EksNr2.jpeg"
},
{
"command": "nugu",
"text": "https://i2.lensdump.com/i/EksP3v.jpeg"
},
{
"command": "nuke",
"text": "https://i3.lensdump.com/i/EksfNC.png"
},
{
"command": "officerjinsoul",
"text": "https://i.lensdump.com/i/EksUW5.jpeg"
},
{
"command": "officerkimlip",
"text": "https://i1.lensdump.com/i/Eksc9z.jpeg"
},
{
"command": "okvit",
"text": "https://i.lensdump.com/i/EksXLT.png"
},
{
"command": "oldbias",
"text": "https://i1.lensdump.com/i/EksbGb.gif"
},
{
"command": "oliviakek",
"text": "https://i.lensdump.com/i/Eksxk7.png"
},
{
"command": "oliviapout",
"text": "https://i1.lensdump.com/i/Eksylr.jpeg"
},
{
"command": "oliviaturn",
"text": "https://i2.lensdump.com/i/Eks5XF.gif"
},
{
"command": "pdthirst",
"text": "https://i.lensdump.com/i/Eksar3.png"
},
{
"command": "police",
"text": "https://i2.lensdump.com/i/Eksh40.jpeg"
},
{
"command": "revoked",
"text": "https://i3.lensdump.com/i/Ek32ND.jpeg"
},
{
"command": "scamberry",
"text": "https://i2.lensdump.com/i/Ek3Aiq.png"
},
{
"command": "scamnet",
"text": "https://i1.lensdump.com/i/Ek3WdA.png"
},
{
"command": "sechuurity",
"text": "https://i3.lensdump.com/i/Ek3iLM.png"
},
{
"command": "shaking",
"text": "https://i.lensdump.com/i/Ek3jaQ.jpeg"
},
{
"command": "shocked",
"text": "https://i3.lensdump.com/i/Ek3Ika.jpeg"
},
{
"command": "talktoomuch",
"text": "https://i2.lensdump.com/i/Ek3Zle.jpeg"
},
{
"command": "tea",
"text": "https://i.lensdump.com/i/Ek3gbk.png"
},
{
"command": "triplets",
"text": "https://i3.lensdump.com/i/Ek3trx.jpeg"
},
{
"command": "vivibigsmirk",
"text": "https://i2.lensdump.com/i/Ek314H.png"
},
{
"command": "vividepressed",
"text": "https://i1.lensdump.com/i/Ek3RP1.jpeg"
},
{
"command": "vivieww",
"text": "https://i.lensdump.com/i/Ek3Eic.png"
},
{
"command": "vivigenius",
"text": "https://i2.lensdump.com/i/Ek3kdK.gif"
},
{
"command": "vivismirk",
"text": "https://i3.lensdump.com/i/Ek36MZ.png"
},
{
"command": "vivitea2",
"text": "https://i1.lensdump.com/i/Ek3CaP.jpeg"
},
{
"command": "viviwut",
"text": "https://i2.lensdump.com/i/Ek3Q6m.jpeg"
},
{
"command": "welcome",
"text": "https://i1.lensdump.com/i/Ek3Vzi.png"
},
{
"command": "wiggle",
"text": "https://i3.lensdump.com/i/Ek39bo.gif"
},
{
"command": "wolf",
"text": "https://i1.lensdump.com/i/Ek3qt9.jpeg"
},
{
"command": "yeoangel",
"text": "https://i3.lensdump.com/i/Ek3mPv.jpeg"
},
{
"command": "yeodemon",
"text": "https://i1.lensdump.com/i/Ek33jC.jpeg"
},
{
"command": "yeogun",
"text": "https://i.lensdump.com/i/Ek34d5.gif"
},
{
"command": "yeojintoorbit",
"text": "https://i3.lensdump.com/i/Ek3KMz.jpeg"
},
{
"command": "yeojinwave",
"text": "https://i1.lensdump.com/i/Ek3phT.gif"
},
{
"command": "yeojinwtf",
"text": "https://i3.lensdump.com/i/Ek3O6b.png"
},
{
"command": "yeoyikes",
"text": "https://i1.lensdump.com/i/Ek3Hz7.jpeg"
},
{
"command": "yikes",
"text": "https://i.lensdump.com/i/Ek3lwr.png"
},
{
"command": "yveehaw",
"text": "https://i1.lensdump.com/i/Ek3StF.jpeg"
},
{
"command": "yvesflex",
"text": "https://i.lensdump.com/i/Ek3eK3.png"
},
{
"command": "yvesjudge",
"text": "https://i1.lensdump.com/i/Ek3nf0.png"
},
{
"command": "yvesproud",
"text": "https://i2.lensdump.com/i/Ek3LjD.png"
},
{
"command": "yvesrich",
"text": "https://i.lensdump.com/i/Ek3Mqq.png"
},
{
"command": "yvessip",
"text": "https://i1.lensdump.com/i/Ek3YYA.gif"
},
{
"command": "yveswave",
"text": "https://i.lensdump.com/i/Ek3ohM.gif"
},
{
"command": "yveswink",
"text": "https://i2.lensdump.com/i/Ek3DCQ.gif"
},
{
"command": "yyxyyikes",
"text": "https://i.lensdump.com/i/Ek3Nza.jpeg"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment