美文网首页
第二周第三课时

第二周第三课时

作者: 采矿 | 来源:发表于2016-05-29 17:21 被阅读7次
    #断点续传功能,来自周作业的main函数
    from multiprocessing import Pool
    from Gchannel_extract import All_channnel_links
    from Gpage_parsing import get_detailinfo, getdetail_links, detail_info, detail_urls
    
    
    def get_all_links(channel):
        for i in range(1, 100):
            getdetail_links(channel, i)
    if __name__ == '__main__':
        pool = Pool()
        pool.map(get_all_links, All_channnel_links.split())
        #断点续传功能
        db_urls = [item['url'] for item in detail_urls.find()]
        index_urls = [item['url'] for item in detail_info.find()]
        x = set(db_urls)
        y = set(index_urls)
        rest_urls = x - y
        pool.map(get_detailinfo, rest_urls)
    

    相关文章

      网友评论

          本文标题:第二周第三课时

          本文链接:https://www.haomeiwen.com/subject/gyjqdttx.html