Your Name %!s(int64=6) %!d(string=hai) anos
pai
achega
4f4574c245
Modificáronse 2 ficheiros con 51 adicións e 50 borrados
  1. 2 1
      hg3535/ball_func.py
  2. 49 49
      hg3535/spiders/zuqiu.py

+ 2 - 1
hg3535/ball_func.py

@@ -383,7 +383,8 @@ def get_pcode(corner_ball, code):
         p_code = "promotion"
         p_id = 10
     elif corner_ball == "罚牌数":
-        p_code = "Penalty_card"
+        # p_code = "Penalty_card"
+        p_code = "penalty_card"
         p_id = 12
     else:
         p_code = code

+ 49 - 49
hg3535/spiders/zuqiu.py

@@ -111,7 +111,7 @@ class ZuqiuSpider(scrapy.Spider):
                         # 开赛时间
                         time_game = data['i'][5]
 
-    # 让球------------------------------------------------------------------------------------------------------------------
+# 让球------------------------------------------------------------------------------------------------------------------
                         try:
                             concedes = data['o']['ah']['v']
                             new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 is 1]
@@ -134,7 +134,7 @@ class ZuqiuSpider(scrapy.Spider):
                             concede_home = ""
                             concede_home_rule = ""
 
-    # 上半场让球half_concede-------------------------------------------------------------------------------------------------
+# 上半场让球half_concede-------------------------------------------------------------------------------------------------
                         try:
                             half_concedes = data['o']['ah1st']['v']
                             new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 is 1]
@@ -158,7 +158,7 @@ class ZuqiuSpider(scrapy.Spider):
                             half_concede_home = ""
                             half_concede_guest_rule = ""
                             half_concede_guest = ""
-    # 全场大小size 进球大小---------------------------------------------------------------------------------------------------
+# 全场大小size 进球大小---------------------------------------------------------------------------------------------------
                         try:
                             sizes = data['o']['ou']['v']
                             new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 is 1]
@@ -182,7 +182,7 @@ class ZuqiuSpider(scrapy.Spider):
                             size_home = ""
                             size_home_rule = ""
 
-    # 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
+# 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
                         try:
                             half_sizes = data['o']['ou1st']['v']
                             new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 is 1]
@@ -211,7 +211,7 @@ class ZuqiuSpider(scrapy.Spider):
                             half_size_home = ""
                             half_size_home_rule = ""
 
-    # 全场总进球 total_goal--------------------------------------------------------------------------------------------------
+# 全场总进球 total_goal--------------------------------------------------------------------------------------------------
                         total_goal = {}
                         try:
                             total_goals = data['o']['tg']['v']
@@ -226,7 +226,7 @@ class ZuqiuSpider(scrapy.Spider):
                             total_goal["total_goal_four"] = ""
                             total_goal["total_goal_seven"] = ""
 
-    # 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
+# 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
                         try:
                             half_total_goals = data['o']['tg1st']['v']
                             new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 is 1]
@@ -240,7 +240,7 @@ class ZuqiuSpider(scrapy.Spider):
                             total_goal["half_total_goal_two"] = ""
                             total_goal["half_total_goal_three"] = ""
 
-    # 早盘 半场/全场---------------------------------------------------------------------------------------------------------
+# 早盘 半场/全场---------------------------------------------------------------------------------------------------------
                         half_full = {}
                         new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest",
                                      "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest",
@@ -255,7 +255,7 @@ class ZuqiuSpider(scrapy.Spider):
                             for index, value in enumerate(new_lists):
                                 half_full[value] = ""
 
-    # 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
+# 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
                         first_last_ball = {}
                         try:
                             first_balls = data['o']['ttslast']['v']
@@ -276,7 +276,7 @@ class ZuqiuSpider(scrapy.Spider):
                         except:
                             pass
 
-    # 全场独赢capot ---------------------------------------------------------------------------------------------------------
+# 全场独赢capot ---------------------------------------------------------------------------------------------------------
 
                         try:
                             capots = data['o']['1x2']['v']
@@ -391,78 +391,78 @@ class ZuqiuSpider(scrapy.Spider):
                         try:
                             home_data = data['o']['ou']['v']
                             # 球队进球 大条件
-                            full_dict_rule['score_home_big'] = home_data[1]
+                            full_dict_rule['home_tema_ball_big'] = home_data[1]
                             # 球队进球小条件
-                            full_dict_rule['score_home_small'] = home_data[3]
+                            full_dict_rule['home_tema_ball_small'] = home_data[3]
 
                             if pt is 3:
                                 # 球队进球大赔率
-                                full_dict['score_home_big'] = round(float(home_data[5]) - 1, 2)
+                                full_dict['home_tema_ball_big'] = round(float(home_data[5]) - 1, 2)
                                 # 球队进球小赔率
-                                full_dict['score_home_small'] = round(float(home_data[7]) - 1, 2)
+                                full_dict['home_tema_ball_small'] = round(float(home_data[7]) - 1, 2)
                             else:
                                 # 球队进球大赔率
-                                full_dict['score_home_big'] = home_data[5]
+                                full_dict['home_tema_ball_big'] = home_data[5]
                                 # 球队进球小赔率
-                                full_dict['score_home_small'] = home_data[7]
+                                full_dict['home_tema_ball_small'] = home_data[7]
                         except:
-                            full_dict['score_home_small'] = ""
-                            full_dict_rule['score_home_small'] = ""
-                            full_dict['score_home_big'] = ""
-                            full_dict_rule['score_home_big'] = ""
+                            full_dict['home_tema_ball_small'] = ""
+                            full_dict_rule['home_tema_ball_small'] = ""
+                            full_dict['home_tema_ball_big'] = ""
+                            full_dict_rule['home_tema_ball_big'] = ""
                         try:
                             half_home_data = data['o']['ou1st']['v']
-                            half_dict_rule['half_score_home_big'] = half_home_data[1]
-                            half_dict_rule['half_score_home_small'] = half_home_data[3]
+                            half_dict_rule['half_home_tema_ball_big'] = half_home_data[1]
+                            half_dict_rule['half_home_tema_ball_small'] = half_home_data[3]
 
                             if pt is 3:
-                                half_dict['half_score_home_big'] = round(float(half_home_data[5]) - 1, 2)
-                                half_dict['half_score_home_small'] = round(float(half_home_data[7]) - 1, 2)
+                                half_dict['half_home_tema_ball_big'] = round(float(half_home_data[5]) - 1, 2)
+                                half_dict['half_home_tema_ball_small'] = round(float(half_home_data[7]) - 1, 2)
                             else:
                                 half_home_size_big = half_home_data[5]
-                                half_dict['half_score_home_big'] = half_home_size_big
+                                half_dict['half_home_tema_ball_big'] = half_home_size_big
                                 half_home_size_small = half_home_data[7]
-                                half_dict['half_score_home_small'] = half_home_size_small
+                                half_dict['half_home_tema_ball_small'] = half_home_size_small
 
                         except:
-                            half_dict_rule['half_score_home_big'] = ""
-                            half_dict['half_score_home_big'] = ""
-                            half_dict_rule['half_score_home_small'] = ""
-                            half_dict['half_score_home_small'] = ""
+                            half_dict_rule['half_home_tema_ball_big'] = ""
+                            half_dict['half_home_tema_ball_big'] = ""
+                            half_dict_rule['half_home_tema_ball_small'] = ""
+                            half_dict['half_home_tema_ball_small'] = ""
 
                     if new_data is 13:
                         try:
                             guest_data = data['o']['ou']['v']
-                            full_dict_rule['score_guest_big'] = guest_data[1]
-                            full_dict_rule['score_guest_small'] = guest_data[3]
+                            full_dict_rule['guest_tema_ball_big'] = guest_data[1]
+                            full_dict_rule['guest_tema_ball_small'] = guest_data[3]
 
                             if pt is 3:
-                                full_dict['score_guest_big'] = round(float(guest_data[5]) - 1, 2)
-                                full_dict['score_guest_small'] = round(float(guest_data[7]) - 1, 2)
+                                full_dict['guest_tema_ball_big'] = round(float(guest_data[5]) - 1, 2)
+                                full_dict['guest_tema_ball_small'] = round(float(guest_data[7]) - 1, 2)
                             else:
-                                full_dict['score_guest_big'] = guest_data[5]
-                                full_dict['score_guest_small'] = guest_data[7]
+                                full_dict['guest_tema_ball_big'] = guest_data[5]
+                                full_dict['guest_tema_ball_small'] = guest_data[7]
                         except:
-                            full_dict_rule['score_guest_big'] = ""
-                            full_dict['score_guest_big'] = ""
-                            full_dict_rule['score_guest_small'] = ""
-                            full_dict['score_guest_small'] = ''
+                            full_dict_rule['guest_tema_ball_big'] = ""
+                            full_dict['guest_tema_ball_big'] = ""
+                            full_dict_rule['guest_tema_ball_small'] = ""
+                            full_dict['guest_tema_ball_small'] = ''
                         try:
                             half_guest_data = data['o']['ou1st']['v']
-                            half_dict_rule['half_score_guest_big'] = half_guest_data[1]
-                            half_dict_rule['half_score_guest_small'] = half_guest_data[3]
+                            half_dict_rule['half_guest_tema_ball_big'] = half_guest_data[1]
+                            half_dict_rule['half_guest_tema_ball_small'] = half_guest_data[3]
                             if pt is 3:
-                                half_dict['half_score_guest_big'] = round(float(half_guest_data[5]) - 1, 2)
-                                half_dict['half_score_guest_small'] = round(float(half_guest_data[7]) - 1, 2)
+                                half_dict['half_guest_tema_ball_big'] = round(float(half_guest_data[5]) - 1, 2)
+                                half_dict['half_guest_tema_ball_small'] = round(float(half_guest_data[7]) - 1, 2)
                             else:
-                                half_dict['half_score_guest_big'] = half_guest_data[5]
-                                half_dict['half_score_guest_small'] = half_guest_data[7]
+                                half_dict['half_guest_tema_ball_big'] = half_guest_data[5]
+                                half_dict['half_guest_tema_ball_small'] = half_guest_data[7]
                         except:
-                            half_dict_rule['half_score_guest_big'] = ""
-                            half_dict['half_score_guest_big'] = ""
+                            half_dict_rule['half_guest_tema_ball_big'] = ""
+                            half_dict['half_guest_tema_ball_big'] = ""
 
-                            half_dict_rule['half_score_guest_small'] = ""
-                            half_dict['half_score_guest_small'] = ""
+                            half_dict_rule['half_guest_tema_ball_small'] = ""
+                            half_dict['half_guest_tema_ball_small'] = ""
 
                 item['league_id'] = league_id
                 item['league_name'] = league_name