def start_requests(self): count = db.get('select count(id) as count from user')['count'] if count: return [scrapy.FormRequest(self.wap_follow_url.format(uk=row['uk'], start=0), callback=self.parse) for row in db.query('select * from user where share=0')] else: return [scrapy.FormRequest(self.wap_follow_url.format(uk=1208824379, start=0), callback=self.parse)]
def start_requests(self): rows = db.query('select uk from user where share=0 limit 10') for row in rows: db.update('update user set share=1 where uk=%s', row['uk']) return [ scrapy.FormRequest(self.share_url.format(uk=row['uk'], start=0), callback=self.parse) for row in rows ]
def start_requests(self): rows = db.query('select uk from user where share=0 limit 10') for row in rows: db.update('update user set share=1 where uk=%s', row['uk']) return [scrapy.FormRequest(self.share_url.format(uk=row['uk'], start=0), callback=self.parse) for row in rows]