def article(url): urlhash = hashlib.md5(url).hexdigest().lower() floor = db.getArticleFloor(urlhash) if floor == None: floor = "1" # print floor # article, floorCount = spider.getUrl(url, floor) title, article, floorCount = gspider.getArticle(url, floor) # print article db.appendArticle(urlhash, article) db.saveArticleFloor(urlhash, floorCount) db.saveArticleTitle(urlhash, title) return db.getAllArticle(urlhash)
def articleWithHash(th): return db.getAllArticle(th)