uses libxml2dom


basically you supply it the url of the gallery
the complete url of all the thumbs will be returned as a list.

def get_thumbs(url):
    tree = libxml2dom.parseURI(url,1)
    anchors = tree.getElementsByTagName("a"Applause


 loc,g_path,g_params,g_query) = urlparse.urlsplit(url)
    result = []
    thumb_exts = [".jpg",".gif",".avi",".mpg",".wmv"]
    for anchor in anchors :
        href = anchor.getAttribute("href"Applause
        #print urlparse.urlsplit(href)


 loc,path,params,query) = urlparse.urlsplit(href)
        (root,ext) = os.path.splitext(path.lower())
        if thumb_exts.count(ext)>0 :
            imgs = anchor.getElementsByTagName("img"Applause
            if len(imgs)>0 :
                img_src = imgs[0].getAttribute("src"Applause
    if len(result)<=0 :
        print url
        raise "Error"
    return result

Perkiset's Place Home   Politics @ Perkiset's