qq_video.py 文件源码

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

项目:multimedia_crawler 作者: JFluo2011 项目源码 文件源码
def parse(self, response):
        user = response.meta['user']
        num = 24
        count = response.xpath('//div[@id="headBgMod"]//ul[@class="user_count"]/li[3]/span[2]/text()').extract()[0]
        for page in range(1, int(math.ceil(int(count) / num)) + 1):
            aa = "1.9.1"
            callback = ''.join(['jQuery', re.sub(r'\D', '', aa + str(random.random())),
                                '_', str(int(time.time() * 1000))])
            params = {
                'otype': 'json',
                'pagenum': str(page),
                'callback': callback,
                'qm': '1',
                'num': str(num),
                'sorttype': '0',
                'orderflag': '0',
                'low_login': '1',
                'uin': re.search(r'data-vuin="(.*?)"', response.body).group(1),
                '_': str(int(time.time() * 1000)),
            }
            url = 'http://c.v.qq.com/vchannelinfo'
            yield scrapy.FormRequest(url, method='GET', meta={'user': user}, formdata=params, callback=self.parse_page)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号