Skip to content

Instantly share code, notes, and snippets.

@OpenBagTwo
Created January 23, 2021 15:37
Show Gist options
  • Save OpenBagTwo/dcedb3b597ed42040f5a3a3f9d45a967 to your computer and use it in GitHub Desktop.
Save OpenBagTwo/dcedb3b597ed42040f5a3a3f9d45a967 to your computer and use it in GitHub Desktop.
A quick experiment with the IMDB API through IMDBpy
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "familiar-idaho",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using imdbpy v2020.09.25\n"
]
}
],
"source": [
"import imdb\n",
"print (f\"Using imdbpy v{imdb.__version__}\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "regulation-machinery",
"metadata": {},
"outputs": [],
"source": [
"ia = imdb.IMDb()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fewer-timber",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<Movie id:0088258[http] title:_This Is Spinal Tap (1984)_>,\n",
" <Movie id:1478760[http] title:_\"The Daily Show\" Spinal Tap (2009)_>,\n",
" <Movie id:0816131[http] title:_\"The Daily Show\" Spinal Tap (2000)_>,\n",
" <Movie id:0123278[http] title:_A Spinal Tap Reunion: The 25th Anniversary London Sell-Out (1992) (TV)_>,\n",
" <Movie id:0439825[http] title:_Spinal Tap: The Final Tour (1998) (V)_>,\n",
" <Movie id:1485786[http] title:_Spinal Tap: Back from the Dead (2009) (V)_>,\n",
" <Movie id:8860852[http] title:_Spinal Tap: Bitch School (1992) (V)_>,\n",
" <Movie id:0178036[http] title:_Spinal Tap: Break Like the Wind - The Videos (1992) (V)_>,\n",
" <Movie id:9353876[http] title:_\"The Goldbergs\" This is This is Spinal Tap (2019)_>,\n",
" <Movie id:2289473[http] title:_\"The Essentials\" This Is Spinal Tap (2012)_>,\n",
" <Movie id:0823147[http] title:_\"VH-1 Where Are They Now?\" This Is Spinal Tap (2000)_>,\n",
" <Movie id:13173894[http] title:_\"Yippee Ki Yay Mother Podcast\" This Is Spinal Tap (2020)_>,\n",
" <Movie id:0433070[http] title:_Spinal Tap Goes to 20 (2004)_>,\n",
" <Movie id:0785574[http] title:_\"My Generation\" Spinal Tap/Tonic (1998)_>,\n",
" <Movie id:12556074[http] title:_\"That Movie Show\" This is Spinal Tap (1984) (2017)_>,\n",
" <Movie id:12445894[http] title:_\"How Did I Miss This?\" This Is Spinal Tap with Andy Gilkeson (2020)_>,\n",
" <Movie id:10641548[http] title:_\"Trailers from Hell\" John Landis on This is Spinal Tap (2013)_>,\n",
" <Movie id:0695021[http] title:_\"Saturday Night Live\" Barry Bostwick/Spinal Tap (1984)_>,\n",
" <Movie id:2106152[http] title:_\"Tonight Live with Steve Vizard\" Interview with Spinal Tap (????)_>,\n",
" <Movie id:2106153[http] title:_\"Tonight Live with Steve Vizard\" Interview with Spinal Tap (????)_>]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ia.search_movie(title=\"Spinal Tap\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "virtual-marijuana",
"metadata": {},
"outputs": [],
"source": [
"spinal_tap = ia.get_movie(\"0088258\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "advisory-consequence",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"['original title',\n",
" 'cast',\n",
" 'genres',\n",
" 'runtimes',\n",
" 'countries',\n",
" 'country codes',\n",
" 'language codes',\n",
" 'color info',\n",
" 'aspect ratio',\n",
" 'sound mix',\n",
" 'box office',\n",
" 'certificates',\n",
" 'original air date',\n",
" 'rating',\n",
" 'votes',\n",
" 'cover url',\n",
" 'imdbID',\n",
" 'plot outline',\n",
" 'languages',\n",
" 'title',\n",
" 'year',\n",
" 'kind',\n",
" 'directors',\n",
" 'writers',\n",
" 'producers',\n",
" 'composers',\n",
" 'cinematographers',\n",
" 'editors',\n",
" 'editorial department',\n",
" 'casting directors',\n",
" 'production designers',\n",
" 'make up department',\n",
" 'production managers',\n",
" 'assistant directors',\n",
" 'art department',\n",
" 'sound department',\n",
" 'special effects',\n",
" 'camera department',\n",
" 'casting department',\n",
" 'costume departmen',\n",
" 'location management',\n",
" 'music department',\n",
" 'script department',\n",
" 'transportation department',\n",
" 'miscellaneous',\n",
" 'thanks',\n",
" 'akas',\n",
" 'writer',\n",
" 'director',\n",
" 'production companies',\n",
" 'distributors',\n",
" 'other companies',\n",
" 'plot',\n",
" 'synopsis',\n",
" 'canonical title',\n",
" 'long imdb title',\n",
" 'long imdb canonical title',\n",
" 'smart canonical title',\n",
" 'smart long imdb canonical title',\n",
" 'full-size cover url']"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spinal_tap.keys()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "authorized-wealth",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.9"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spinal_tap['rating']"
]
},
{
"cell_type": "markdown",
"id": "flying-spine",
"metadata": {},
"source": [
"Checks out\n",
"\n",
"![this is spinal tap's rating](spinal-tap-screenshot.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "injured-repair",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment