def parse_data(self, response): html = json.loads(response.body) # 最新一条等开计划信息 endlist = html.get('EndList') item = CpPlanItem() item['title'] = html.get('NewGame')['WaitGame'] item['type'] = 71 item['gameId'] = 7 yield item # 其余的计划信息 for each in endlist: item = CpPlanItem() # print(each) item['title'] = each['Ruestl'] item['type'] = 71 item['gameId'] = 7 yield item # 爬取 即刻开奖信息 item = Wait_Item() N1 = html.get('TopGame')['R1'] N2 = html.get('TopGame')['R2'] N3 = html.get('TopGame')['R3'] N4 = html.get('TopGame')['R4'] N5 = html.get('TopGame')['R5'] N6 = html.get('TopGame')['R6'] N7 = html.get('TopGame')['R7'] N8 = html.get('TopGame')['R8'] N9 = html.get('TopGame')['R9'] N10 = html.get('TopGame')['R10'] item['num'] = '{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}'.format(N1, N2, N3, N4, N5, N6, N7, N8, N9, N10) item['gamedate'] = html.get('TopGame')['gameid'] item['gameId'] = 7 yield item
def parse_data(self, response): html = json.loads(response.body) # 最新一条等开计划信息 endlist = html.get('EndList') item = CpPlanItem() item['title'] = html.get('NewGame')['WaitGame'] item['type'] = 41 item['gameId'] = 4 yield item # 其余的计划信息 for each in endlist: item = CpPlanItem() # print(each) item['title'] = each['Ruestl'] item['type'] = 41 item['gameId'] = 4 yield item # 爬取 即刻开奖信息 item = Wait_Item() N1 = html.get('TopGame')['R1'] N2 = html.get('TopGame')['R2'] N3 = html.get('TopGame')['R3'] item['num'] = '{0},{1},{2}'.format(N1, N2, N3) item['gamedate'] = html.get('TopGame')['gameid'] item['gameId'] = 4 yield item
def parse_data(self,response): html = json.loads(response.body) # 最新一条等开计划信息 endlist = html.get('EndList') item = CpPlanItem() item['title'] = html.get('NewGame')['WaitGame'] yield item # 其余的计划信息 for each in endlist: item = CpPlanItem() # print(each) item['title'] = each['Ruestl'] item['type'] = html.get('GameMultiple')['Gt'] item['gameId'] = '五分彩' count_num = len(item['title']) yield item # 爬取 即刻开奖信息 item = Wait_Item() item['N1'] = html.get('TopGame')['R1'] item['N2'] = html.get('TopGame')['R2'] item['N3'] = html.get('TopGame')['R3'] item['N4'] = html.get('TopGame')['R4'] item['N5'] = html.get('TopGame')['R5'] item['gamedate'] = html.get('TopGame')['gameid'] item['gameId'] = '五分彩' yield item
def parse(self, response): html = json.loads(response.body) # 爬取 即刻开奖信息 item = Wait_Item() N1 = html.get('TopGame')['R1'] N2 = html.get('TopGame')['R2'] N3 = html.get('TopGame')['R3'] N4 = html.get('TopGame')['R4'] N5 = html.get('TopGame')['R5'] item['num'] = '{0},{1},{2},{3},{4}'.format(N1, N2, N3, N4, N5) item['gamedate'] = html.get('TopGame')['gameid'] item['gameId'] = 2 yield item # 最新一条等开计划信息 endlist = html.get('EndList') item = CpPlanItem() item['title'] = html.get('NewGame')['WaitGame'] if response.url == 'http://56070.la/json/cqssc.json': item['type'] = 21 elif response.url == 'http://56070.la/json/cqssc_h2zx.json': item['type'] = 22 elif response.url == 'http://56070.la/json/cqssc_h3zx.json': item['type'] = 23 else: item['type'] = 24 item['gameId'] = 2 yield item # 其余的计划信息 for each in endlist: item = CpPlanItem() # print(each) item['title'] = each['Ruestl'] if response.url == 'http://56070.la/json/cqssc.json': item['type'] = 21 elif response.url == 'http://56070.la/json/cqssc_h2zx.json': item['type'] = 22 elif response.url == 'http://56070.la/json/cqssc_h3zx.json': item['type'] = 23 else: item['type'] = 24 item['gameId'] = 2 yield item