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)
评论列表
文章目录