def auto_Jandan(): """ 自动抓取煎蛋页面 """ jandanid = kv.get("jandan::id") if not jandanid: jandanid = 4000 get_jandan_page(jandanid) kv.set("jandan::id", jandanid+1) return str(jandanid)
def select_unfetch_book_isbn(): """获取1个还没从豆瓣获取书籍的isbn """ fetch_id = kv.get("douban::fetch:id") if not fetch_id: fetch_id = 0 with closing(db_pool.connection()) as db: book_count_row = db.get(" SELECT COUNT(*) AS `count` FROM `bookinfo`") book_count = book_count_row["count"] if fetch_id > book_count: fetch_id = 0 isbn_raw = db.get( """ SELECT `bookinfo`.`isbn` FROM `bookinfo` LIMIT %s, 1""", fetch_id, ) kv.set("douban::fetch:id", fetch_id + 1) return isbn_raw["isbn"]