All pastes #70521 Raw Edit

Anonymous

public text v1 · immutable
#70521 ·published 2006-06-24 11:26 UTC
rendered paste body
import os,sys,re,urllib

#NZB_ = {'Details':[], 'Genre':[], 'Year':[], 'Tagline':[], 'Plot':[], 'Rating':[], 'Runtime':[], 'Actor':[], 'Alias':[]}

def Details(url):
    global detail
    IMDb_ = {'Details':[]}
    details = re.compile(r'<p class="plotpar">.*')
    in_details = re.compile(r'">(.*?)</p>')
    sock = urllib.urlopen(url)
    page = sock.readlines()
    sock.close()

    for i in page:
        if details.match(i) != None:
            try:
                IMDb_['Details'].append(in_details.search(i).group(1).strip())
            except:
                IMDb_['Details'].append('None')
    return str(IMDb_['Details'])

detail = Details("http://www.imdb.com/title/tt0233469/plotsummary")
print detail