Exemplo n.º 1
0
    def get_data(self, response):
        item = getCoarseData()

        i = 1
        for key in response.meta:
            if i < 8:
                item[key] = response.meta[key]
                i += 1

        company_list = {'Bet365': 3}

        get_inside('peilv', company_list, response, item)

        return item
Exemplo n.º 2
0
    def get_ouzhi(self,response):
        item = dailyDataItem()

        i = 1
        for key in response.meta:
            if i < 7:
                item[key] = response.meta[key]
                i += 1

        company_list = {'Bet365':3}

        get_inside('peilv',company_list,response,item)

        return item
Exemplo n.º 3
0
    def get_kaili(self, response):
        item = getCoarseData()
        # item['round'] = response.meta['round']
        # item['saiji'] = response.meta['saiji']
        # item['hscore'] = response.meta['hscore']
        # item['gscore'] = response.meta['gscore']
        # item['hname'] = response.meta['hname']
        # item['gname'] = response.meta['gname']

        #获取比赛常规数据
        i = 1
        for key in response.meta:
            if i < 8:
                item[key] = response.meta[key]
                i += 1

        #company_list = {'William':293,'Bet365':3}
        company_list = {'Bet365': 3}
        # #odds = response.xpath('//*[@id="293"]/td[6]/table/tbody/tr[1]/td/text()').extract()
        # # set_kaili('start','William',response,item)
        # # set_kaili('start', 'Bet365', response, item)
        # get_inside('kaili',company_list,response,item)
        # #odds = response.xpath('//*[@id="293"]/td[6]/table/tbody/tr[2]/td/text()').extract()
        # # set_kaili('final','William',response,item)
        # # set_kaili('final','Bet365',response,item)
        #
        # #odds = response.xpath('//*[@id="293"]/td[3]/table/tbody/tr[1]/td/text()').extract()
        # # set_peilv('start', 'William', response, item)
        # # set_peilv('start', 'Bet365', response, item)
        get_inside('peilv', company_list, response, item)
        #
        # #odds = response.xpath('//*[@id="293"]/td[3]/table/tbody/tr[2]/td/text()').extract()
        # # set_peilv('final', 'William', response, item)
        # # set_peilv('final', 'Bet365', response, item)
        #
        # #fanli = response.xpath('//*[@id="293"]/td[5]/table/tbody/tr[1]/td/text()').extract()
        # # set_fanli('start','William',response,item)
        # # set_fanli('start','Bet365',response,item)
        # get_inside('fanli',company_list,response,item)
        #
        # #fanli = response.xpath('//*[@id="293"]/td[5]/table/tbody/tr[2]/td/text()').extract()
        # # set_fanli('final', 'William', response, item)
        # # set_fanli('final','Bet365',response,item)

        return item
        #print(item)


# def set_kaili(cata,company,response,item):
#     if company == 'William' and cata == 'start':
#         odds = response.xpath('//*[@id="293"]/td[6]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'start':
#         odds = response.xpath('//*[@id="3"]/td[6]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'William' and cata == 'final':
#         odds = response.xpath('//*[@id="293"]/td[6]/table/tbody/tr[2]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'final':
#         odds = response.xpath('//*[@id="3"]/td[6]/table/tbody/tr[2]/td/text()').extract()
#
#     if odds:
#         odds = list(map(float, odds))
#         item['kaili_win_%s_%s' % (cata,company)] = odds[0]
#         item['kaili_draw_%s_%s' % (cata,company)] = odds[1]
#         item['kaili_lose_%s_%s' % (cata,company)] = odds[2]
#     else:
#         item['kaili_win_%s_%s' % (cata,company)] = 0
#         item['kaili_draw_%s_%s' % (cata,company)] = 0
#         item['kaili_lose_%s_%s' % (cata,company)] = 0
#
# def set_peilv(cata,company,response,item):
#     if company == 'William' and cata == 'start':
#         odds = response.xpath('//*[@id="293"]/td[3]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'start':
#         odds = response.xpath('//*[@id="3"]/td[3]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'William' and cata == 'final':
#         odds = response.xpath('//*[@id="293"]/td[3]/table/tbody/tr[2]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'final':
#         odds = response.xpath('//*[@id="3"]/td[3]/table/tbody/tr[2]/td/text()').extract()
#
#     if odds:
#         odds = [x.strip() for x in odds]
#         odds = list(map(float, odds))
#         item['peilv_win_%s_%s' % (cata,company)] = odds[0]
#         item['peilv_draw_%s_%s' % (cata,company)] = odds[1]
#         item['peilv_lose_%s_%s' % (cata,company)] = odds[2]
#     else:
#         item['peilv_win_%s_%s' % (cata,company)] = 0
#         item['peilv_draw_%s_%s' % (cata,company)] = 0
#         item['peilv_lose_%s_%s' % (cata,company)] = 0
#
# def set_fanli(cata,company,response,item):
#     if company == 'William' and cata == 'start':
#         fanli = response.xpath('//*[@id="293"]/td[5]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'start':
#         fanli = response.xpath('//*[@id="3"]/td[5]/table/tbody/tr[1]/td/text()').extract()
#     elif company == 'William' and cata == 'final':
#         fanli = response.xpath('//*[@id="293"]/td[5]/table/tbody/tr[2]/td/text()').extract()
#     elif company == 'Bet365' and cata == 'final':
#         fanli = response.xpath('//*[@id="3"]/td[5]/table/tbody/tr[2]/td/text()').extract()
#     if fanli:
#         fanli = [x.replace('%', '') for x in fanli]
#         fanli = list(map(float, fanli))
#         item['fanli_%s_%s' % (cata,company)] = fanli[0]
#     else:
#         item['fanli_%s_%s' % (cata, company)] = 0