LocationCrawler.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:InstagramLocationScraper 作者: VoodaGod 项目源码 文件源码
def scrapeCitiesFromList(cityList, dirPrefix, threadCount, scrapers):
    """scrapes locations in cities in cityList to file in dirPrefix, spawns threadCount threads"""
    threads = []
    i = 0
    while(True):
        if(threading.active_count() <= threadCount):
            if(i == len(cityList)):
                break
            for s in scrapers:
                if(not s.inUse):
                    threads.append(ScrapeThread(target=scrapeCityToFile, args=(dirPrefix, cityList[i], s)))
                    threads[-1].start()
                    i += 1
                    break
        time.sleep(1)

    for t in threads:
        t.join()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号