Exemplo n.º 1
0
def get_keyword(q):
    conn = inser_redis()
    num = conn.llen("keywordlist")
    for k in range(557, num):
        print(k),
        result = conn.lindex("keywordlist", k)
        q.put(result)
Exemplo n.º 2
0
def get_keyword():
    conn = inser_redis()
    # num = conn.llen("keywordlist")
    # for k in range(1, num):
    #     print(k)

    while True:
        result = conn.lpop("keywordlist")
        logging.info("获取关键字:{}".format(result))
        if not result:
            logging.info("list空")
            break
        requests_baidu_keyword(result)
Exemplo n.º 3
0
                dicts["url"] = r2.url
                dicts["index"] = index_id
                return dicts

            # print(dicts)


def sss(obj):
    pass


if __name__ == "__main__":

    config_log()
    s = time.time()
    conn_redis = inser_redis()
    # t1 = threading.Thread(target=get_keyword, args=(q,))
    # t1.start()
    # t1.join()
    "3469"
    th = ThreadPoolExecutor(max_workers=100)
    results = []

    while True:
        result = conn_redis.lpop("keywordlist")
        logging.info("获取关键字:{}".format(result))
        if not result:
            logging.info("list空")
            break

        rep = th.submit(request_detail, result)