【问题标题】:How can I force stop my crawler on getting a specific url crawled last time?如何在上次抓取特定网址时强制停止我的爬虫?
【发布时间】:2017-11-30 13:05:41
【问题描述】:

我正在制作一个爬虫来查找最近添加的 youtube 视频我想在我的爬虫到达旧视频时停止我的爬虫(在上一轮爬取)。我没有使用scrapy 和beautifulsoup 我使用的是python 库。请建议我任何选择

【问题讨论】:

    标签: python beautifulsoup scrapy web-crawler html-parsing


    【解决方案1】:

    不会简单的检查和通过工作吗?

    if video in list_of_crawled_videos:
        pass
    else:
        list_of_crawled_videos.append(video)
    

    【讨论】:

    • 不,它只是不拍那个特定的视频,而是继续继续
    • 然后将break 替换为pass =)
    • @Amrinder,我的建议有帮助吗?
    猜你喜欢
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多