def start_get_hot_expert(t): while 1: logging.info("start get hot expert") sql = Sql() try: sql.execute("truncate table hot_expert") sql.db.commit() except Exception as e: print(e) sql.close() get_hot_expert(0) get_hot_expert(1) time.sleep(t)
def start_articles(): print("start") sql = Sql() ret, err = sql.execute("select id from expert") if err != 0: return ret = [i[0] for i in ret] for id in ret: get_expert_league_info(id)
def get_articles(t): while 1: sql = Sql() ret, err = sql.execute("select id from expert") expert_ids = [] if err == 0: expert_ids = [id[0] for id in ret] for id in expert_ids: get_expert_articles(id) time.sleep(t)
def start_article_details(): sql = Sql() ret, err = sql.execute("select id from articles") for r in ret: get_article_detail(r[0])