Skip to content

Instantly share code, notes, and snippets.

@se7enack
Last active January 3, 2024 15:30
Show Gist options
  • Save se7enack/91eb858cc4fe311a7e8cfe6fc37d7d22 to your computer and use it in GitHub Desktop.
Save se7enack/91eb858cc4fe311a7e8cfe6fc37d7d22 to your computer and use it in GitHub Desktop.
Displays artwork for a given motion picture
#!/usr/bin/env python3
import json
import sys
import urllib.request as ur
from PIL import Image
movie = sys.argv[1].replace(" ","%20")
filename = sys.argv[1].replace(" ","_") + ".jpg"
def call(url):
req = ur.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
r = ur.urlopen(req).read()
body = json.loads(r.decode().replace("#",""))
return(body)
initailcall = call('https://search.imdbot.workers.dev/?q=' + movie)
fullcall = call('https://search.imdbot.workers.dev/?tt='+ initailcall['description'][0]['IMDB_ID'])
image = fullcall['short']['image']
ur.urlretrieve(
image,
filename
)
img = Image.open(filename)
img.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment