All pastes #70544 Raw Edit

Someone

public python v1 · immutable
#70544 ·published 2006-06-24 12:16 UTC
rendered paste body
import os,sys,re,urllib#NZB_ = {'Details':[], 'Genre':[], 'Year':[], 'Tagline':[], 'Plot':[], 'Rating':[], 'Runtime':[], 'Actor':[], 'Alias':[]}def Details(url):    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'])[2:-2]def Genre(url):    IMDb_ = {'Genre':[]}    genres = re.compile(r'<a href="/Sections/Genres/.*')    in_genres = re.compile(r'<a href="/Sections/Genres/(.*?)/')    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if genres.match(i) != None:            try:                IMDb_['Genre'].append(in_genres.search(i).group(1).strip())            except:                IMDb_['Genre'].append('None')    return str(IMDb_['Genre'])[2:-2]def Year(url):    IMDb_ = {'Year':[]}    year = re.compile(r'.*<a href="/Sections/Years/.*')    in_year = re.compile(r'<a href="/Sections/Years/.*">(.*?)</a>')    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if year.match(i) != None:            try:                IMDb_['Year'].append(in_year.search(i).group(1).strip())            except:                IMDb_['Year'].append('None')    return str(IMDb_['Year'])[2:-2]def Tagline(url):    IMDb_ = {'Tagline':[]}    tagline = re.compile(r'<b class="ch">Tagline:</b>.*')    in_tagline = re.compile(r"</b>(.*)")    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if tagline.match(i) != None:            try:                IMDb_['Tagline'].append(in_tagline.search(i).group(1).strip())            except:                IMDb_['Tagline'].append('None')    return str(IMDb_['Tagline'])[2:-72]def Plot(url):    IMDb_ = {'Plot':[]}    plot = re.compile(r'<b class="ch">Plot Outline:</b>.*')    in_plot = re.compile(r"</b>(.*?)<a href")    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if plot.match(i) != None:            try:                IMDb_['Plot'].append(in_plot.search(i).group(1).strip())            except:                IMDb_['Plot'].append('None')    return str(IMDb_['Plot'])[2:-2]def Rating(url):    IMDb_ = {'Rating':[]}    rating = re.compile(r'<b>.*/.*</b>.*')    in_rating = re.compile(r"<b>(.*?)/.*</b> .*")    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if rating.match(i) != None:            try:                IMDb_['Rating'].append(in_rating.search(i).group(1).strip())            except:                IMDb_['Rating'].append('None')    return str(IMDb_['Rating'][0])def Runtime(url):    IMDb_ = {'Runtime':[]}    runtime = re.compile(r'(.*?) min')    in_runtime = re.compile(r"(.*?) min")    sock = urllib.urlopen(url)    page = sock.readlines()    sock.close()    for i in page:        if runtime.match(i) != None:            try:                IMDb_['Runtime'].append(in_runtime.search(i).group(1).strip())            except:                IMDb_['Runtime'].append('None')    return str(IMDb_['Runtime'])[2:-2] + " min"