middlewares.py 文件源码

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

项目:multimedia_crawler 作者: JFluo2011 项目源码 文件源码
def process_request(self, request, spider):
        if 'http://v.youku.com/v_show/' in request.url:
            url = request.url.split('?')[0]
        else:
            url = request.url
        if self.col.find_one({'$and': [
            {'host': spider.name},
            {'url': url},
            # {'download': {'$in': [0, 1, 2]}}
            {'download': {'$ne': -1}},
        ]}):
            logging.warning('the page is crawled, url is {0}'.format(url))
            raise IgnoreRequest()

        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号