Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6ec5a45

Browse files
Merge pull request avinashkranjan#2037 from Adhivp/master
Random meme from internet
2 parents 60a6e2a + f3a1eb3 commit 6ec5a45

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

‎Random meme from internet/Main.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
import urllib.request #only import if you want to display meme in your local device
3+
from PIL import Image #only import if you want to display meme in your local device
4+
5+
6+
###Main code###
7+
response = requests.get('https://meme-api.com/gimme') # add /n to get required number of memes (where n is a number)
8+
meme = response.json()
9+
meme_url = meme['url'] # if more than 1 meme accordingly change the code
10+
##############
11+
12+
####Code to open image####
13+
urllib.request.urlretrieve(meme_url,"file.png") #change to gif/jpeg,if you get gif/jpeg as a meme
14+
img = Image.open("file.png")
15+
img.show()
16+
#######################

‎Random meme from internet/readme.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Random Meme Generator
2+
3+
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.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Pillow==10.0.0
2+
Requests==2.31.0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /