Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Random meme from internet/Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import requests
import urllib.request #only import if you want to display meme in your local device
from PIL import Image #only import if you want to display meme in your local device


###Main code###
response = requests.get('https://meme-api.com/gimme') # add /n to get required number of memes (where n is a number)
meme = response.json()
meme_url = meme['url'] # if more than 1 meme accordingly change the code
##############

####Code to open image####
urllib.request.urlretrieve(meme_url,"file.png") #change to gif/jpeg,if you get gif/jpeg as a meme
img = Image.open("file.png")
img.show()
#######################
3 changes: 3 additions & 0 deletions Random meme from internet/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Random Meme Generator

This is a simple random meme generator that fetches random memes from the internet using a Meme API. Just run the code and the code is self explanatory.
2 changes: 2 additions & 0 deletions Random meme from internet/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pillow==10.0.0
Requests==2.31.0