Home > python > Check downloaded movies on imdb.com

Check downloaded movies on imdb.com

Recently, I downloaded a nice pack of horror movies. The pack contained more than a hundred movies :) I wanted to see their IMDB ratings to decide which ones to watch, but typing their titles in the browser would be too much work. Could it be automated?


Each movie was located in a subdirectory. Here is an extract:


Fortunately, the directories were named in a consistent way: title of the movie (words separated with a dot), year, extra info. Thus, extracting titles was very easy. Idea: collect the titles in a list and open them in Firefox on imdb.com, each in a new tab.

First, I redirected the directory list in a file. It was easier to work with a text file than doing globbing:

ls >a.txt

And finally, here is the script:

#!/usr/bin/env python

import re
import urllib
import webbrowser

base = 'http://www.imdb.com/find?s=all'
firefox = webbrowser.get('firefox')

f1 = open('a.txt', 'r')

for line in f1:
    line = line.rstrip('\n')
    if line.startswith('#'):

    # else
    result = re.search(r'(.*)\.\d{4}\..*', line)
    if result:
        address = result.group(1).replace('.', ' ')
        url = "%s&q=%s" % ( base, urllib.quote(address) )
        print url
        #webbrowser.open_new_tab(url)    # try this if the line above doesn't work


Achtung! Don’t try it with a huge list, otherwise your system will die :) Firefox won’t handle too many open tabs… Try to open around ten titles at a time. In the input file (a.txt) you can comment lines by adding a leading ‘#‘ sign, thus those lines will be discarded by the script.

Categories: python Tags: , , , ,
  1. March 28, 2011 at 18:28

    You can find here a software that checks the rates of your movies automatically. http://www.bikod.com/genel/imdb-rate-checker-imdb-puan-sorgulama-programi.html

  2. March 29, 2011 at 13:28

    Sorry but not open source and doesn’t support Linux. But it’s still under construction. You can find new available versions from this link soon.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: