All pastes #159280 Raw Edit

Anonymous

public python v1 · immutable
·published 2006-09-02 21:58 UTC
rendered paste body
class IMDbGallery:    def __init__(self, url):        sock = urllib.urlopen(url)        page = sock.read()        sock.close()        self.Gal1_info = 'N/A'        self.Gal2_info = 'N/A'        #self.Gal3_info = 'N/A'        lvl1 = re.compile('<a href="photogallery(.*?)"><img src="(.*?)".*') # width="(.*?)" height="(.*?)".*')        lvl2 = re.compile('<td><a href=".*?"><img src="(.*?)" width=".*?" height=".*?"')        #lvl3 = re.compile('class="photosrc"><td><img src="(.*?)" border=".*?" width="(.*?)" height="(.*?)">')        if cover.search(page) != None:            image = cover.findall(page)            self.CoverURL = []            for a in image:                self.CoverURL.append(a[0])        if lvl1.search(page) != None:            Gal_Lvl1 = lvl1.findall(page)            self.Gal1_info   = {}            for g1 in Gal_Lvl1:                g = url + g1[0]                self.Gal1_info[g] = g1[1]        if lvl2.search(page) != None:            Gal_Lvl2 = lvl2.findall(page)            Gal2_info = []            Gal2_full = []            self.Gal2_info = {}            for a in Gal_Lvl2:                Gal2_info.append(a)                Gal2_full.append(a)            print Gal2_info            print Gal2_full            NewDic = {}            for key, value in Gal2_full.items(): NewDic[key] = value.replace('th-','')                            #self.Gal2_info   = {}            #for cnt, a in enumerate(Gal_Lvl2):            #    Gal_Lvl2[cnt] = a.replace('th-','')            #    self.Gal2_info[Gal_Lvl2] = Gal_Lvl2            imdb = IMDbGallery('http://www.imdb.com/title/tt0315824/photogallery-ss-0').Gal2_infoprint imdb