# -*- coding: utf-8 -*- import datetime import json import time import redis import scrapy from scrapy.http import Request from ..settings import R_HOST, R_PASSWORD, R_POST, R_DB from ..items import Roll_Lanqiu def rangqiu_daxiao(inner): concede = [inner[i] for i in range(len(inner)) if i % 2 == 1] # 主队让球条件赔率 concedehome = [concede[i] for i in range(len(concede)) if i % 2 == 0] # 客队让球条件赔率 concedeguest = [concede[i] for i in range(len(concede)) if i % 2 == 1] # 主队让球条件 concede_home_rule = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 0] # 主队让球赔率 concede_home = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 1] # 客队让球条件 concede_guest_rule = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 0] # 客队让球赔率 concede_guest = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 1] return concede_home_rule, concede_home, concede_guest_rule, concede_guest def danshaung_fun(inner): odd_even = [inner[i] for i in range(len(inner)) if i % 2 == 1] # 全场 总分单 odd_even_odd = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 0] # 全场 总分双 odd_even_even = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 1] return odd_even_odd, odd_even_even class LanqiuSpider(scrapy.Spider): name = "roll_lanqiu" to_day = datetime.datetime.now() allowed_domains = ['hg3535z.com'] start_urls = ['https://odata.yonghuai5515.com/odds6i/d/getodds/zh-cn/sid/2/pt/4/ubt/am/pn/0/sb/2/dc/null/pid/0'] custom_settings = { "ITEM_PIPELINES": { "hg3535.pipeline.roll_lanqiu.Roll_Lanqiupipeline": 200, }, # 'LOG_LEVEL': 'DEBUG', # 'LOG_FILE': "../hg3535/log/roll_lanqiu_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day) } rls = redis.Redis(host=R_HOST, port=R_POST, db=R_DB, password=R_PASSWORD) def parse(self, response): responses = json.loads(response.text) try: datas = responses["i-ot"] except: print("暂无滚球篮球数据") return if datas: for data in datas: egs = data.get('egs') if egs: for es in egs: es = es['es'] for e in es: match_id = e['i'][16] creation = time.strftime('%Y-%m-%d', time.localtime()) self.rls.hsetnx('hg3535.GunQiu.ids', match_id, creation) url = 'https://odata.yonghuai5515.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/true/ubt/am/isp/false'.format(match_id) yield Request(url=url, callback=self.parse_other, dont_filter=True) else: print('篮球滚球数据,为空,无比赛') return def parse_other(self, response): try: new_datas = json.loads(response.text).get('eg', "") except: new_datas = '' item = Roll_Lanqiu() if new_datas: # 联赛id league_id = new_datas.get("c", "").get("k", "") # 联赛名 league_name = new_datas.get("c", "").get("n", "") new_data = new_datas.get("es", "") # result = new_data[0] team_scores_dict = {} team_scores_dict_rule = {} for result in new_data: ctid = result['pci']['ctid'] if ctid == 0: # 比赛id game_id = str(result['k']) # 球队1 team_home = result['i'][0] # 球队2 team_guest = result['i'][1] # 数量(97>) number = result['i'][2] # 比赛状态 zhuangtai = result['i'][3] # 日期 data_game = result['i'][4] # 开赛时间 滚球实际只有一个进行时间 # time_game = result['i'][5] try: time_game = result['sb']['ct'] except: time_game = '00:00' # 队1分数 score_home1 = result['i'][10] # 队2分数 score_guest1 = result['i'][11] # 第几节 jijie = result['i'][12] # 球队得分 qiudui = result['pci'].get('ctn', "") # ----------------------------------------让球分割线--------------------------------------------------------------------------- concedes_dict = {} concedes_dict_rule = {} try: concedes = result['o']["ah"]["v"] # print(concedes) # 主队让球条件,主队让球赔率,客队让球条件,客队让球赔率 concede_home_rule, concede_home, concede_guest_rule, concede_guest = rangqiu_daxiao(inner=concedes) concedes_dict_rule['coh'] = concede_home_rule concedes_dict['coh'] = concede_home concedes_dict_rule['cog'] = concede_guest_rule concedes_dict['cog'] = concede_guest except: concedes_dict_rule['coh'] = "" concedes_dict['coh'] = "" concedes_dict_rule['cog'] = "" concedes_dict['cog'] = "" # print(concedes_dict) try: half_concedes = result['o']["ah1st"]["v"] # 上半场 主队让球条件 half_concede_home_rule, half_concede_home, half_concede_guest_rule, half_concede_guest = rangqiu_daxiao(inner=half_concedes) concedes_dict_rule['coh_h'] = half_concede_home_rule concedes_dict['coh_h'] = half_concede_home concedes_dict_rule['cog_h'] = half_concede_guest_rule concedes_dict['cog_h'] = half_concede_guest except: concedes_dict_rule['coh_h'] = "" concedes_dict['coh_h'] = "" concedes_dict_rule['cog_h'] = "" concedes_dict['cog_h'] = "" # 第一节让球 try: one_concedes = result['o']["ahq1"]["v"] one_concede_home_rule, one_concede_home, one_concede_guest_rule, one_concede_guest = rangqiu_daxiao(inner=one_concedes) concedes_dict_rule['coh_1'] = one_concede_home_rule concedes_dict['coh_1'] = one_concede_home concedes_dict_rule['cog_1'] = one_concede_guest_rule concedes_dict['cog_1'] = one_concede_guest except: concedes_dict_rule['coh_1'] = "" concedes_dict['coh_1'] = "" concedes_dict_rule['cog_1'] = "" concedes_dict['cog_1'] = "" # 第二节让球 try: two_concedes = result['o']["ahq2"]["v"] two_concede_home_rule, two_concede_home, two_concede_guest_rule, two_concede_guest = rangqiu_daxiao(inner=two_concedes) concedes_dict_rule['coh_2'] = two_concede_home_rule concedes_dict['coh_2'] = two_concede_home concedes_dict_rule['cog_2'] = two_concede_guest_rule concedes_dict['cog_2'] = two_concede_guest except: concedes_dict_rule['coh_2'] = "" concedes_dict['coh_2'] = "" concedes_dict_rule['cog_2'] = "" concedes_dict['cog_2'] = "" # 第三节让球 try: three_concedes = result['o']["ahq3"]["v"] three_concede_home_rule, three_concede_home, three_concede_guest_rule, three_concede_guest = rangqiu_daxiao(inner=three_concedes) concedes_dict_rule['coh_3'] = three_concede_home_rule concedes_dict['coh_3'] = three_concede_home concedes_dict_rule['cog_3'] = three_concede_guest_rule concedes_dict['cog_3'] = three_concede_guest except: concedes_dict_rule['coh_3'] = "" concedes_dict['coh_3'] = "" concedes_dict_rule['cog_3'] = "" concedes_dict['cog_3'] = "" # 第四节让球 try: four_concedes = result['o']["ahq4"]["v"] four_concede_home_rule, four_concede_home, four_concede_guest_rule, four_concede_guest = rangqiu_daxiao(inner=four_concedes) concedes_dict_rule['coh_4'] = four_concede_home_rule concedes_dict['coh_4'] = four_concede_home concedes_dict_rule['cog_4'] = four_concede_guest_rule concedes_dict['cog_4'] = four_concede_guest except: concedes_dict_rule['coh_4'] = "" concedes_dict['coh_4'] = "" concedes_dict_rule['cog_4'] = "" concedes_dict['cog_4'] = "" # ----------------------------------------总分大小分割线 - --------------------------------------------------------------- # 全场总分大小 total_sizes_dict = {} total_sizes_dict_rule = {} try: total_sizes = result['o']["ou"]["v"] total_sizes_big_rule, total_sizes_big, total_sizes_small_rule, total_sizes_small = rangqiu_daxiao(inner=total_sizes) total_sizes_dict_rule["tnb"] = total_sizes_big_rule total_sizes_dict["tnb"] = total_sizes_big total_sizes_dict_rule["tns"] = total_sizes_small_rule total_sizes_dict["tns"] = total_sizes_small except: total_sizes_dict_rule["tnb"] = "" total_sizes_dict["tnb"] = "" total_sizes_dict_rule["tns"] = "" total_sizes_dict["tns"] = "" # 上半场总分大小 try: half_total_sizes = result['o']["ou1st"]["v"] half_total_sizes_big_rule, half_total_sizes_big, half_total_sizes_small_rule, half_total_sizes_small = rangqiu_daxiao( inner=half_total_sizes) total_sizes_dict_rule["tnb_h"] = half_total_sizes_big_rule total_sizes_dict["tnb_h"] = half_total_sizes_big total_sizes_dict_rule["tns_h"] = half_total_sizes_small_rule total_sizes_dict["tns_h"] = half_total_sizes_small except: total_sizes_dict_rule["tnb_h"] = "" total_sizes_dict["tnb_h"] = "" total_sizes_dict_rule["tns_h"] = "" total_sizes_dict["tns_h"] = "" # 第一节总分大小 try: one_total_sizes = result['o']["ouq1"]["v"] one_total_sizes_big_rule, one_total_sizes_big, one_total_sizes_small_rule, one_total_sizes_small = rangqiu_daxiao( inner=one_total_sizes) total_sizes_dict_rule["tnb_1"] = one_total_sizes_big_rule total_sizes_dict["tnb_1"] = one_total_sizes_big total_sizes_dict_rule["tns_1"] = one_total_sizes_small_rule total_sizes_dict["tns_1"] = one_total_sizes_small except: total_sizes_dict_rule["tnb_1"] = "" total_sizes_dict["tnb_1"] = "" total_sizes_dict_rule["tns_1"] = "" total_sizes_dict["tns_1"] = "" # 第二节场总分大小 try: two_total_sizes = result['o']["ouq2"]["v"] two_total_sizes_big_rule, two_total_sizes_big, two_total_sizes_small_rule, two_total_sizes_small = rangqiu_daxiao( inner=two_total_sizes) total_sizes_dict_rule["tnb_2"] = two_total_sizes_big_rule total_sizes_dict["tnb_2"] = two_total_sizes_big total_sizes_dict_rule["tns_2"] = two_total_sizes_small_rule total_sizes_dict["tns_2"] = two_total_sizes_small except: total_sizes_dict_rule["tnb_2"] = "" total_sizes_dict["tnb_2"] = "" total_sizes_dict_rule["tns_2"] = "" total_sizes_dict["tns_2"] = "" # 第三节总分大小 try: three_total_sizes = result['o']["ouq3"]["v"] three_total_sizes_big_rule, three_total_sizes_big, three_total_sizes_small_rule, three_total_sizes_small = rangqiu_daxiao( inner=three_total_sizes) total_sizes_dict_rule["tnb_3"] = three_total_sizes_big_rule total_sizes_dict["tnb_3"] = three_total_sizes_big total_sizes_dict_rule["tns_3"] = three_total_sizes_small_rule total_sizes_dict["tns_3"] = three_total_sizes_small except: total_sizes_dict_rule["tnb_3"] = "" total_sizes_dict["tnb_3"] = "" total_sizes_dict_rule["tns_3"] = "" total_sizes_dict["tns_3"] = "" # 第四节总分大小 try: four_total_sizes = result['o']["ouq4"]["v"] four_total_sizes_big_rule, four_total_sizes_big, four_total_sizes_small_rule, four_total_sizes_small = rangqiu_daxiao( inner=four_total_sizes) total_sizes_dict_rule["tnb_4"] = four_total_sizes_big_rule total_sizes_dict["tnb_4"] = four_total_sizes_big total_sizes_dict_rule["tns_4"] = four_total_sizes_small_rule total_sizes_dict["tns_4"] = four_total_sizes_small except: total_sizes_dict_rule["tnb_4"] = "" total_sizes_dict["tnb_4"] = "" total_sizes_dict_rule["tns_4"] = "" total_sizes_dict["tns_4"] = "" # ----------------------------------------总分单双分割线------------------------------------------------------------------ # 全场 总分单双 odd_evens_dict = {} odd_evens_dict_rule = {} try: odd_evens = result['o']["oe"]["v"] # 全场 总分单, 全场 总分双 odd_evens_dict["tss"] = odd_evens[1] odd_evens_dict_rule['tss'] = '单' odd_evens_dict["tsd"] = odd_evens[3] odd_evens_dict_rule['tsd'] = '双' except: odd_evens_dict["tss"] = "" odd_evens_dict_rule['tss'] = '单' odd_evens_dict["tsd"] = "" odd_evens_dict_rule['tsd'] = '双' # 上半场全场 总分单双 try: half_odd_evens = result['o']["oe1st"]["v"] # 上半场 总分单, 上半场 总分双 odd_evens_dict["tss_h"] = half_odd_evens[1] odd_evens_dict_rule['tss_h'] = '单' odd_evens_dict["tsd_h"] = half_odd_evens[3] odd_evens_dict_rule['tsd_h'] = '双' except: # half_odd_even_odd = "" # half_odd_even_even = "" odd_evens_dict["tss_h"] = "" odd_evens_dict_rule['tss_h'] = '单' odd_evens_dict["tsd_h"] = "" odd_evens_dict_rule['tsd_h'] = '双' # 总分:单/双-第一节 try: one_odd_evens = result['o']["oeq1"]["v"] odd_evens_dict["tss_1"] = one_odd_evens[1] odd_evens_dict_rule['tss_1'] = '单' odd_evens_dict["tsd_1"] = one_odd_evens[3] odd_evens_dict_rule['tsd_1'] = '双' except: odd_evens_dict["tss_1"] = "" odd_evens_dict_rule['tss_1'] = '单' odd_evens_dict["tsd_1"] = "" odd_evens_dict_rule['tsd_1'] = '双' # 总分:单/双-第二节 try: two_odd_evens = result['o']["oeq2"]["v"] odd_evens_dict["tss_2"] = two_odd_evens[1] odd_evens_dict_rule['tss_2'] = '单' odd_evens_dict["tsd_2"] = two_odd_evens[3] odd_evens_dict_rule['tsd_2'] = '双' except: # two_odd_even_odd = "" # two_odd_even_even = "" odd_evens_dict["tss_2"] = "" odd_evens_dict_rule['tss_2'] = '单' odd_evens_dict["tsd_2"] = "" odd_evens_dict_rule['tsd_2'] = '双' # 总分:单/双-第三节 try: three_odd_evens = result['o']["oeq3"]["v"] odd_evens_dict["tss_3"] = three_odd_evens[1] odd_evens_dict_rule['tss_3'] = '单' odd_evens_dict["tsd_3"] = three_odd_evens[3] odd_evens_dict_rule['tsd_3'] = '双' except: odd_evens_dict["tss_3"] = "" odd_evens_dict_rule['tss_3'] = '单' odd_evens_dict["tsd_3"] = "" odd_evens_dict_rule['tsd_3'] = '双' # 总分:单/双-第四节 try: four_odd_evens = result['o']["oeq4"]["v"] odd_evens_dict["tss_4"] = four_odd_evens[1] odd_evens_dict_rule['tss_4'] = '单' odd_evens_dict["tsd_4"] = four_odd_evens[3] odd_evens_dict_rule['tsd_4'] = '双' except: odd_evens_dict["tss_4"] = "" odd_evens_dict_rule['tss_4'] = '单' odd_evens_dict["tsd_4"] = "" odd_evens_dict_rule['tsd_4'] = '双' # ----------------------------------------球队得分最后一位数分割线--------------------------------------------------------- # 球队得分最后一位数 主队 last_numbers_dict = {} try: last_numbers = result["p-o"][0]['o'] last_home = {} for last_number in last_numbers: last_home[last_number[0]] = last_number[2] except: last_home = {} last_numbers_dict["last_home"] = last_home # 球队得分最后一位数 客队 try: new_last_numbers = result["p-o"][1]['o'] last_guest = {} for new_last_number in new_last_numbers: last_guest[new_last_number[0]] = new_last_number[2] except: last_guest = {} last_numbers_dict["last_guest"] = last_guest # ------------------------------------------------------独赢分割线--------------------------------------------------------- capots_dict = {} # 独赢 try: capots = result['o']["ml"]["v"] capot_list = [capots[i] for i in range(len(capots)) if i % 2 == 1] capot_home = capot_list[0] capot_guest = capot_list[1] capots_dict["ch"] = capot_home capots_dict["cg"] = capot_guest except: capots_dict["ch"] = "" capots_dict["cg"] = "" # 上半场独赢 try: half_capots = result['o']["ml1st"]["v"] half_capot_list = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1] half_capot_home = half_capot_list[0] half_capot_guest = half_capot_list[1] capots_dict["ch_h"] = half_capot_home capots_dict["cg_h"] = half_capot_guest except: capots_dict["ch_h"] = "" capots_dict["cg_h"] = "" # 第一节独赢 try: one_capots = result['o']["mlq1"]["v"] one_capot_list = [one_capots[i] for i in range(len(one_capots)) if i % 2 == 1] one_capot_home = one_capot_list[0] one_capot_guest = one_capot_list[1] capots_dict["ch_1"] = one_capot_home capots_dict["cg_1"] = one_capot_guest except: capots_dict["ch_1"] = "" capots_dict["cg_1"] = "" # 第二节独赢 try: two_capots = result['o']["mlq2"]["v"] two_capot_list = [two_capots[i] for i in range(len(two_capots)) if i % 2 == 1] two_capot_home = two_capot_list[0] two_capot_guest = two_capot_list[1] capots_dict["ch_2"] = two_capot_home capots_dict["cg_2"] = two_capot_guest except: capots_dict["ch_2"] = "" capots_dict["cg_2"] = "" # 第三节独赢 try: three_capots = result['o']["mlq3"]["v"] three_capot_list = [three_capots[i] for i in range(len(three_capots)) if i % 2 == 1] three_capot_home = three_capot_list[0] three_capot_guest = three_capot_list[1] capots_dict["ch_3"] = three_capot_home capots_dict["cg_3"] = three_capot_guest except: capots_dict["ch_3"] = "" capots_dict["cg_3"] = "" # 第四节独赢 try: four_capots = result['o']["mlq4"]["v"] four_capot_list = [four_capots[i] for i in range(len(four_capots)) if i % 2 == 1] four_capot_home = four_capot_list[0] four_capot_guest = four_capot_list[1] capots_dict["ch_4"] = four_capot_home capots_dict["cg_4"] = four_capot_guest except: capots_dict["ch_4"] = "" capots_dict["cg_4"] = "" score_dict = {} try: # 当前节 score_dict['schedule'] = result['sb']['cp'] # 时间 score_dict['r_time'] = result['sb']['ct'] # "sc_1th_H": "15", //第一节 主队得分 # "sc_1th_C": "16", //第一节 客队得分 score_dict['sc_1th_H'] = result['sb']['ps'][2]['h'] score_dict['sc_1th_C'] = result['sb']['ps'][2]['a'] score_dict['sc_2th_H'] = result['sb']['ps'][3]['h'] score_dict['sc_2th_C'] = result['sb']['ps'][3]['a'] score_dict['sc_3th_H'] = result['sb']['ps'][4]['h'] score_dict['sc_3th_C'] = result['sb']['ps'][4]['a'] score_dict['sc_4th_H'] = result['sb']['ps'][5]['h'] score_dict['sc_4th_C'] = result['sb']['ps'][5]['a'] score_dict['overtime_H'] = result['sb']['ps'][7]['h'] score_dict['overtime_C'] = result['sb']['ps'][7]['a'] score_dict['half_H'] = result['sb']['ps'][0]['h'] score_dict['half_C'] = result['sb']['ps'][0]['a'] score_dict['full_H'] = result['sb']['ps'][6]['h'] score_dict['full_C'] = result['sb']['ps'][6]['a'] score_dict['whole_H'] = result['sb']['ps'][1]['h'] score_dict['whole_C'] = result['sb']['ps'][1]['a'] except: pass # ---------------------------------------------------华丽分割线列表es[1]----------------------------------- # 球队得分大/小 全场主队 home if ctid == 41: if result: try: score_homes = result["o"]["ou"]['v'] score_home_big_rule, score_home_big, score_home_small_rule, score_home_small = rangqiu_daxiao(inner=score_homes) team_scores_dict_rule["tbhb"] = score_home_big_rule team_scores_dict["tbhb"] = score_home_big team_scores_dict_rule["tbhs"] = score_home_small_rule team_scores_dict["tbhs"] = score_home_small except: team_scores_dict_rule["tbhb"] = "" team_scores_dict["tbhb"] = "" team_scores_dict_rule["tbhs"] = "" team_scores_dict["tbhs"] = "" # 球队得分 上半场主队 home try: half_score_homes = result['o']['ou1st']['v'] # 球队得分 上半场主队 大条件 half_score_home_big_rule, half_score_home_big, half_score_home_small_rule, half_score_home_small = rangqiu_daxiao( inner=half_score_homes) team_scores_dict_rule["tbhb_h"] = half_score_home_big_rule team_scores_dict["tbhb_h"] = half_score_home_big team_scores_dict_rule["tbhs_h"] = half_score_home_small_rule team_scores_dict["tbhs_h"] = half_score_home_small except: team_scores_dict_rule["tbhb_h"] = "" team_scores_dict["tbhb_h"] = "" team_scores_dict_rule["tbhs_h"] = "" team_scores_dict["tbhs_h"] = "" # 球队得分:主队-大 / 小-第一节 try: one_score_homes = result['o']["ouq1"]["v"] one_score_home_big_rule, one_score_home_big, one_score_home_small_rule, one_score_home_small = rangqiu_daxiao( inner=one_score_homes) team_scores_dict_rule["tbhb_1"] = one_score_home_big_rule team_scores_dict["tbhb_1"] = one_score_home_big team_scores_dict_rule["tbhs_1"] = one_score_home_small_rule team_scores_dict["tbhs_1"] = one_score_home_small except: team_scores_dict_rule["tbhb_1"] = "" team_scores_dict["tbhb_1"] = "" team_scores_dict_rule["tbhs_1"] = "" team_scores_dict["tbhs_1"] = "" # 球队得分:主队-大 / 小-第二节 try: two_score_homes = result['o']["ouq2"]["v"] two_score_home_big_rule, two_score_home_big, two_score_home_small_rule, two_score_home_small = rangqiu_daxiao( inner=two_score_homes) team_scores_dict_rule["tbhb_2"] = two_score_home_big_rule team_scores_dict["tbhb_2"] = two_score_home_big team_scores_dict_rule["tbhs_2"] = two_score_home_small_rule team_scores_dict["tbhs_2"] = two_score_home_small except: team_scores_dict_rule["tbhb_2"] = "" team_scores_dict["tbhb_2"] = "" team_scores_dict_rule["tbhs_2"] = "" team_scores_dict["tbhs_2"] = "" # 球队得分:主队-大 / 小-第三节 try: three_score_homes = result['o']["ouq3"]["v"] three_score_home_big_rule, three_score_home_big, three_score_home_small_rule, three_score_home_small = rangqiu_daxiao( inner=three_score_homes) team_scores_dict_rule["tbhb_3"] = three_score_home_big_rule team_scores_dict["tbhb_3"] = three_score_home_big team_scores_dict_rule["tbhs_3"] = three_score_home_small_rule team_scores_dict["tbhs_3"] = three_score_home_small except: team_scores_dict_rule["tbhb_3"] = "" team_scores_dict["tbhb_3"] = "" team_scores_dict_rule["tbhs_3"] = "" team_scores_dict["tbhs_3"] = "" # 球队得分:主队-大 / 小-第四节 try: four_score_homes = result['o']["ouq4"]["v"] four_score_home_big_rule, four_score_home_big, four_score_home_small_rule, four_score_home_small = rangqiu_daxiao( inner=four_score_homes) team_scores_dict_rule["tbhb_4"] = four_score_home_big_rule team_scores_dict["tbhb_4"] = four_score_home_big team_scores_dict_rule["tbhs_4"] = four_score_home_small_rule team_scores_dict["tbhs_4"] = four_score_home_small except: team_scores_dict_rule["tbhs_4"] = "" team_scores_dict["tbhb_4"] = "" team_scores_dict_rule["tbhs_4"] = "" team_scores_dict["tbhs_4"] = "" # ---------------------------------------------------华丽分割线列表es[2]----------------------------------- # 球队得分 客队 guest if ctid == 42: if result: try: # 球队得分: 大 / 小 score_guests = result["o"]["ou"]['v'] score_guest_big_rule, score_guest_big, score_guest_small_rule, score_guest_small = rangqiu_daxiao(inner=score_guests) team_scores_dict_rule["tbgb"] = score_guest_big_rule team_scores_dict["tbgb"] = score_guest_big team_scores_dict_rule["tbgs"] = score_guest_small_rule team_scores_dict["tbgs"] = score_guest_small except: team_scores_dict_rule["tbgb"] = "" team_scores_dict["tbgb"] = "" team_scores_dict_rule["tbgs"] = "" team_scores_dict["tbgs"] = "" # 球队得分 上半场客队 guest try: half_score_guests = result["o"]['ou1st']['v'] half_score_guest_big_rule, half_score_guest_big, half_score_guest_small_rule, half_score_guest_small = rangqiu_daxiao( inner=half_score_guests) team_scores_dict_rule["tbgb_h"] = half_score_guest_big_rule team_scores_dict["tbgb_h"] = half_score_guest_big team_scores_dict_rule["tbgs_h"] = half_score_guest_small_rule team_scores_dict["tbgs_h"] = half_score_guest_small except: team_scores_dict_rule["tbgb_h"] = "" team_scores_dict["tbgb_h"] = "" team_scores_dict_rule["tbgs_h"] = "" team_scores_dict["tbgs_h"] = "" # 球队得分第一节 try: one_score_guests = result["o"]['ouq1']['v'] one_score_guest_big_rule, one_score_guest_big, one_score_guest_small_rule, one_score_guest_small = rangqiu_daxiao( inner=one_score_guests) team_scores_dict_rule["tbgb_1"] = one_score_guest_big_rule team_scores_dict["tbgb_1"] = one_score_guest_big team_scores_dict_rule["tbgs_1"] = one_score_guest_small_rule team_scores_dict["tbgs_1"] = one_score_guest_small except: team_scores_dict_rule["tbgb_1"] = "" team_scores_dict["tbgb_1"] = "" team_scores_dict_rule["tbgs_1"] = "" team_scores_dict["tbgs_1"] = "" # 球队得分第二节 try: two_score_guests = result["o"]['ouq2']['v'] two_score_guest_big_rule, two_score_guest_big, two_score_guest_small_rule, two_score_guest_small = rangqiu_daxiao( inner=two_score_guests) team_scores_dict_rule["tbgb_2"] = two_score_guest_big_rule team_scores_dict["tbgb_2"] = two_score_guest_big team_scores_dict_rule["tbgs_2"] = two_score_guest_small_rule team_scores_dict["tbgs_2"] = two_score_guest_small except: team_scores_dict_rule["tbgb_2"] = "" team_scores_dict["tbgb_2"] = "" team_scores_dict_rule["tbgs_2"] = "" team_scores_dict["tbgs_2"] = "" # 球队得分第三节 try: three_score_guests = result["o"]['ouq3']['v'] three_score_guest_big_rule, three_score_guest_big, three_score_guest_small_rule, three_score_guest_small = rangqiu_daxiao( inner=three_score_guests) team_scores_dict_rule["tbgb_3"] = three_score_guest_big_rule team_scores_dict["tbgb_3"] = three_score_guest_big team_scores_dict_rule["tbgs_3"] = three_score_guest_small_rule team_scores_dict["tbgs_3"] = three_score_guest_small except: team_scores_dict_rule["tbgb_3"] = "" team_scores_dict["tbgb_3"] = "" team_scores_dict_rule["tbgs_3"] = "" team_scores_dict["tbgs_3"] = "" # 球队得分第四节 try: four_score_guests = result["o"]['ouq4']['v'] four_score_guest_big_rule, four_score_guest_big, four_score_guest_small_rule, four_score_guest_small = rangqiu_daxiao( inner=four_score_guests) team_scores_dict_rule["tbgb_4"] = four_score_guest_big_rule team_scores_dict["tbgb_4"] = four_score_guest_big team_scores_dict_rule["tbgs_4"] = four_score_guest_small_rule team_scores_dict["tbgs_4"] = four_score_guest_small except: team_scores_dict_rule["tbgb_4"] = "" team_scores_dict["tbgb_4"] = "" team_scores_dict_rule["tbgs_4"] = "" team_scores_dict["tbgs_4"] = "" # 篮球详细比分 # 联赛id item['league_id'] = league_id # 联赛名 item['league_name'] = league_name # item['result'] = result # 比赛id item['game_id'] = game_id # 球队1 item['team_home'] = team_home # 球队2 item['team_guest'] = team_guest # 数量(97>) item['number'] = number # 比赛状态 item['zhuangtai'] = zhuangtai # 日期 item['data_game'] = data_game # 开赛时间 item['time_game'] = time_game # 队1分数 item['score_home'] = score_home1 # 队2分数 item['score_guest'] = score_guest1 # 第几节 item['jijie'] = jijie # 球队得分 item['qiudui'] = qiudui item['concede'] = concedes_dict item['concede_rule'] = concedes_dict_rule item['odd_even'] = odd_evens_dict item['odd_even_rule'] = odd_evens_dict_rule item['total_size'] = total_sizes_dict item['total_size_rule'] = total_sizes_dict_rule item['last_number'] = last_numbers_dict item['capot'] = capots_dict item['team_score'] = team_scores_dict item['team_score_rule'] = team_scores_dict_rule item['score_dict'] = score_dict yield item