Imgflip Logo Icon

tge silly

tge silly | 34 lines of code | image tagged in tge silly | made w/ Imgflip meme maker
59 views 4 upvotes Made by -Katlin- 20 hours ago in MS_memer_group
tge silly memeCaption this Meme
3 Comments
0 ups, 20h
local args = { ... } -- Collect command line arguments so you can actually control ts

local configFile = fs.open("disk/config.json", "r") -- read from configuration file (holds user and pass)
local config = textutils.unserialiseJSON(configFile.readAll()) -- parse config to lua table
print(configFile.readAll())
configFile.close()

-- construct http POST body
local body = "template_id=" .. args[1] .. "&username=" .. textutils.urlEncode(config.username) .. "&password=" .. textutils.urlEncode(config.password)
body = body .. "&text0=" .. textutils.urlEncode(args[2]) .. "&text1=" .. textutils.urlEncode(args[3])

local response = http.post("https://api.imgflip.com/caption_image", body) -- send request
local tbl = textutils.unserialiseJSON(response.readAll()) -- parse to lua table
local serialised = textutils.serialise(tbl) -- reserialise to text for pretty print
print(serialised)
response.close()

local responseFile = fs.open("disk/out/caption_results.txt", "w") -- save the response to a file
responseFile.write(serialised)
responseFile.close()

-- save the generated image to files for extra credit on this school project (i'm joking, i made this for fun)
local imgURL = tbl.data.url
local imgID = string.sub(imgURL, -10)

print(imgURL)

local imgFile = fs.open("disk/out/" .. imgID, "w")

local image = http.get(imgURL)

imgFile.write(image.readAll())
image.close()
imgFile.close()
0 ups, 19h,
1 reply
GET RULE 34'D | image tagged in get rule 34'd | made w/ Imgflip meme maker
34?
0 ups, 19h
Okay, genuinely what the f**k did I find
tge silly memeCaption this Meme
Created with the Imgflip Meme Generator
IMAGE DESCRIPTION:
34 lines of code