zuqiu.py 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. # -*- coding: utf-8 -*-
  2. import copy
  3. import json
  4. import scrapy
  5. from scrapy.http import Request
  6. from .. items import Zuqiu
  7. import datetime
  8. class ZuqiuSpider(scrapy.Spider):
  9. name = 'zuqiu'
  10. to_day = datetime.datetime.now()
  11. # print(to_day.year, to_day)
  12. allowed_domains = ['hg3535z.com']
  13. custom_settings = {
  14. "ITEM_PIPELINES":{
  15. 'hg3535.pipeline.zuqiu.Zuqiupipeline': 300,
  16. },
  17. # 'LOG_LEVEL': 'DEBUG',
  18. # 'LOG_FILE': "../hg3535/log/zuqiu_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day),
  19. # 'RETRY_ENABLED': False,
  20. # 'COOKIES_ENABLED': False,
  21. # 'DOWNLOAD_TIMEOUT': 1,
  22. # 'SCHEDULER_PERSIST': False,
  23. # 'SCHEDULER_FLUSH_ON_START': False,
  24. }
  25. def start_requests(self):
  26. for y in range(1, 4):
  27. for i in range(10):
  28. y = str(y)
  29. i = str(i)
  30. # yield y
  31. url = "https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/1/pt/"+y+"/ubt/am/pn/"+i+"/sb/2/dc/null/pid/0"
  32. yield scrapy.Request(url=url, callback=self.parse, dont_filter=True, meta={'pt': y})
  33. def parse(self, response):
  34. if response.status == 200:
  35. if response.text:
  36. try:
  37. datas = json.loads(response.text).get('n-ot', "").get('egs', "")
  38. except:
  39. # datas = ''
  40. print("为获取到数据")
  41. return
  42. pt = copy.copy(response.meta['pt'])
  43. for result in datas:
  44. new_results = result['es']
  45. for new_result in new_results:
  46. game_id = str(new_result['i'][16])
  47. pass
  48. if pt == "3":
  49. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/"+str(game_id)+"/iip/false/ubt/am/isp/true"
  50. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  51. if pt == "2":
  52. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/"+str(game_id)+"/iip/false/ubt/am/isp/false"
  53. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  54. if pt == "1":
  55. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/"+str(game_id)+"/iip/false/ubt/am/isp/false"
  56. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  57. #
  58. def parse_each(self, response):
  59. if response.status == 200:
  60. # 球队进球数 大小
  61. try:
  62. datas = json.loads(response.text)['eg']['es']
  63. league_id = json.loads(response.text)['eg']['c']['k']
  64. # 联赛名
  65. league_name = json.loads(response.text)['eg']['c']['n']
  66. zuqiu = json.loads(response.text)['i'][31]
  67. except:
  68. datas = ""
  69. league_id = ""
  70. # 联赛名
  71. league_name = ""
  72. zuqiu = ""
  73. try:
  74. pt = response.meta['pt']
  75. except:
  76. pt = 0
  77. if datas:
  78. item = Zuqiu()
  79. full_dict = {}
  80. half_dict = {}
  81. full_dict_rule = {}
  82. half_dict_rule = {}
  83. for data in datas:
  84. try:
  85. new_data = data['pci']['ctid']
  86. except:
  87. new_data = ""
  88. if new_data == 0:
  89. # 比赛id
  90. game_id = str(data['k'])
  91. # 球队1
  92. team_home = data['i'][0]
  93. # 球队2
  94. team_guest = data['i'][1]
  95. # 数量(97>)
  96. number = data['i'][2]
  97. # 下半场
  98. half_way = data['i'][12]
  99. # 角球或者其他
  100. try:
  101. corner_ball = data['pci']['ctn']
  102. except:
  103. corner_ball = 0
  104. # 日期
  105. data_game = data['i'][4]
  106. # 开赛时间
  107. time_game = data['i'][5]
  108. # 让球------------------------------------------------------------------------------------------------------------------
  109. try:
  110. concedes = data['o']['ah']['v']
  111. new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 is 1]
  112. concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 0]
  113. concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 0]
  114. # concede_home
  115. concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 1]
  116. # concede_guest_rule
  117. concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if
  118. i % 2 == 0]
  119. if pt is 3:
  120. concede_guest = [round(float(concede_guests[i]) -1, 2) for i in range(len(concede_guests)) if i % 2 is 1]
  121. concede_home = [round(float(concede_homes[i]) - 1, 2) for i in range(len(concede_homes)) if i % 2 is 1]
  122. else:
  123. concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 is 1]
  124. concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 1]
  125. except:
  126. concede_guest = ""
  127. concede_guest_rule = ""
  128. concede_home = ""
  129. concede_home_rule = ""
  130. # 上半场让球half_concede-------------------------------------------------------------------------------------------------
  131. try:
  132. half_concedes = data['o']['ah1st']['v']
  133. new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 is 1]
  134. new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 0]
  135. # half_concede_home_rule
  136. half_concede_home_rule = [new_half_concede_homes[i] for i in
  137. range(len(new_half_concede_homes)) if i % 2 == 0]
  138. # concede_home
  139. half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 is 1]
  140. # concede_guest_rule
  141. half_concede_guest_rule = [half_concede_guests[i] for i in
  142. range(len(half_concede_guests)) if i % 2 == 0]
  143. if pt is 3:
  144. half_concede_home = [round(float(new_half_concede_homes[i]) - 1, 2) for i in range(len(new_half_concede_homes)) if i % 2 is 1]
  145. half_concede_guest = [round(float(half_concede_guests[i]) - 1, 2) for i in range(len(half_concede_guests)) if i % 2 is 1]
  146. else:
  147. half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 is 1]
  148. half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 is 1]
  149. except:
  150. half_concede_home_rule = ""
  151. half_concede_home = ""
  152. half_concede_guest_rule = ""
  153. half_concede_guest = ""
  154. # 全场大小size 进球大小---------------------------------------------------------------------------------------------------
  155. try:
  156. sizes = data['o']['ou']['v']
  157. new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 is 1]
  158. size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 0]
  159. # size_home_rule
  160. size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 0]
  161. # size_home
  162. size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 1]
  163. # size_guest_rule
  164. size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 0]
  165. # csize_guest
  166. if pt is 3:
  167. size_guest = [round(float(size_guests[i]) - 1, 2) for i in range(len(size_guests)) if i % 2 is 1]
  168. size_home = [round(float(size_homes[i]) - 1, 2) for i in range(len(size_homes)) if i % 2 is 1]
  169. else:
  170. size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 1]
  171. size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 1]
  172. except:
  173. size_guest = ""
  174. size_guest_rule = ""
  175. size_home = ""
  176. size_home_rule = ""
  177. # 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
  178. try:
  179. half_sizes = data['o']['ou1st']['v']
  180. new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 is 1]
  181. half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 0]
  182. # size_home_rule
  183. half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if
  184. i % 2 is 0]
  185. half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 1]
  186. # half_size_guest_rule 客队
  187. half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if
  188. i % 2 is 0]
  189. # half_size_guest
  190. if pt is 3:
  191. half_size_guest = [round(float(half_size_guests[i]) - 1, 2) for i in range(len(half_size_guests)) if
  192. i % 2 is 1]
  193. half_size_home = [round(float(half_size_homes[i]) - 1, 2) for i in range(len(half_size_homes)) if
  194. i % 2 is 1]
  195. else:
  196. half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if
  197. i % 2 is 1]
  198. half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 is 1]
  199. except:
  200. half_size_guest = ""
  201. half_size_guest_rule = ""
  202. half_size_home = ""
  203. half_size_home_rule = ""
  204. # 全场总进球 total_goal--------------------------------------------------------------------------------------------------
  205. total_goal = {}
  206. try:
  207. total_goals = data['o']['tg']['v']
  208. new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 is 1]
  209. total_goal["total_goal_zero"] = round(float(new_total_goals[0]) - 1, 2)
  210. total_goal["total_goal_two"] = round(float(new_total_goals[1]) - 1, 2)
  211. total_goal["total_goal_four"] = round(float(new_total_goals[2]) - 1, 2)
  212. total_goal["total_goal_seven"] = round(float(new_total_goals[3]) - 1, 2)
  213. except:
  214. total_goal["total_goal_zero"] = ""
  215. total_goal["total_goal_two"] = ""
  216. total_goal["total_goal_four"] = ""
  217. total_goal["total_goal_seven"] = ""
  218. # 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
  219. try:
  220. half_total_goals = data['o']['tg1st']['v']
  221. new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 is 1]
  222. total_goal["half_total_goal_zero"] = round(float(new_half_total_goals[0]) - 1, 2)
  223. total_goal["half_total_goal_one"] = round(float(new_half_total_goals[1]) - 1, 2)
  224. total_goal["half_total_goal_two"] = round(float(new_half_total_goals[2]) - 1, 2)
  225. total_goal["half_total_goal_three"] = round(float(new_half_total_goals[3]) - 1, 2)
  226. except:
  227. total_goal["half_total_goal_zero"] = ""
  228. total_goal["half_total_goal_one"] = ""
  229. total_goal["half_total_goal_two"] = ""
  230. total_goal["half_total_goal_three"] = ""
  231. # 早盘 半场/全场---------------------------------------------------------------------------------------------------------
  232. half_full = {}
  233. new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest",
  234. "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest",
  235. "half_full_guest_home", "half_full_guest_dogfall", "half_full_guest_guest"]
  236. # 早盘 半场/全场
  237. try:
  238. half_fulls = data['o']['hf']['v']
  239. new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 is 1]
  240. for index, value in enumerate(new_lists):
  241. half_full[value] = round(float(new_half_fulls[index]) - 1, 2)
  242. except:
  243. for index, value in enumerate(new_lists):
  244. half_full[value] = ""
  245. # 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
  246. first_last_ball = {}
  247. try:
  248. first_balls = data['o']['ttslast']['v']
  249. first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 is 1]
  250. first_last_ball['first_ball_home'] = round(float(first_ball[0]) - 1, 2)
  251. first_last_ball['first_ball_guest'] = round(float(first_ball[1]) - 1, 2)
  252. except:
  253. pass
  254. # 早盘 最先/最后进球 最后进球
  255. try:
  256. last_balls = data['o']['tts1st']['v']
  257. last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 is 1]
  258. first_last_ball['last_ball_home'] = round(float(last_ball[0]) - 1, 2)
  259. first_last_ball['last_ball_guest'] = round(float(last_ball[1]) - 1, 2)
  260. first_last_ball['not_ball'] = round(float(last_ball[2]) - 1, 2)
  261. except:
  262. pass
  263. # 全场独赢capot ---------------------------------------------------------------------------------------------------------
  264. try:
  265. capots = data['o']['1x2']['v']
  266. new_capots = [capots[i] for i in range(len(capots)) if i % 2 is 1]
  267. capot_home = round(float(new_capots[0]) - 1, 2)
  268. capot_guest = round(float(new_capots[1]) - 1, 2)
  269. capot_dogfall = round(float(new_capots[2]) - 1, 2)
  270. except:
  271. capot_home = ""
  272. capot_guest = ""
  273. capot_dogfall = ""
  274. # 上半场独赢capot
  275. try:
  276. half_capots = data['o']['1x21st']['v']
  277. new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 is 1]
  278. half_capot_home = round(float(new_half_capots[0]) - 1, 2)
  279. half_capot_guest = round(float(new_half_capots[1]) - 1, 2)
  280. half_capot_dogfall = round(float(new_half_capots[2]) - 1, 2)
  281. except:
  282. half_capot_home = ""
  283. half_capot_guest = ""
  284. half_capot_dogfall = ""
  285. # 全场入球:单/双 odd_even------------------------------------------------------------------------------------------------
  286. try:
  287. odd_evens = data['o']['oe']['v']
  288. new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 is 1]
  289. if pt is 3:
  290. odd_even_odd = round(float(new_odd_evens[0]) - 1, 2)
  291. odd_even_even = round(float(new_odd_evens[1]) - 1, 2)
  292. else:
  293. odd_even_odd = round(float(new_odd_evens[0]), 2)
  294. odd_even_even = round(float(new_odd_evens[1]), 2)
  295. except:
  296. odd_even_odd = ""
  297. odd_even_even = ""
  298. # 半场入球:单/双 half_odd_even
  299. try:
  300. half_odd_evens = data['o']['oe1st']['v']
  301. new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 is 1]
  302. if pt is 3:
  303. half_odd_even_odd = round(float(new_half_odd_evens[0]) - 1, 2)
  304. half_odd_even_even = round(float(new_half_odd_evens[1]) - 1, 2)
  305. else:
  306. half_odd_even_odd = new_half_odd_evens[0]
  307. half_odd_even_even = new_half_odd_evens[1]
  308. except:
  309. half_odd_even_odd = ""
  310. half_odd_even_even = ""
  311. bodan_data = {}
  312. # 波胆------------------------------------------------------------------------------------------------------------------
  313. try:
  314. bodans = data['o']['cs']['v']
  315. one_list = ["bodanhome_one_zero", "bodanhome_two_zero", "bodanhome_two_one",
  316. "bodanhome_three_zero", "bodanhome_three_one", "bodanhome_three_two",
  317. "bodanhome_four_zero", "bodanhome_four_one", "bodanhome_four_two",
  318. "bodanhome_four_three"]
  319. two_list = ["bodanguest_one_zero", "bodanguest_two_zero", "bodanguest_two_one",
  320. "bodanguest_three_zero", "bodanguest_three_one", "bodanguest_three_two",
  321. "bodanguest_four_zero", "bodanguest_four_one", "bodanguest_four_two",
  322. "bodanguest_four_three"]
  323. three_list = ["bodandogfall_zero_zero", "bodandogfall_one_one", "bodandogfall_two_two",
  324. "bodandogfall_three_three", "bodandogfall_four_four"]
  325. new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 is 1]
  326. new_bodan = new_bodans[0:20]
  327. # 主队bodan_home
  328. bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 0]
  329. for index, t in enumerate(one_list):
  330. bodan_data[t] = round(float(bodan_home[index]) - 1, 2)
  331. # 客队bodan_guest
  332. bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 1]
  333. for y, z in enumerate(two_list):
  334. bodan_data[z] = round(float(bodan_guest[y]) - 1, 2)
  335. bodan_dogfall = new_bodans[-7:-2]
  336. for a, b in enumerate(three_list):
  337. bodan_data[b] = round(float(bodan_dogfall[a]) - 1, 2)
  338. # 其他bodan_other
  339. bodan_data['bodanother'] = round(float(new_bodans[-1]) - 1, 2)
  340. except:
  341. pass
  342. try:
  343. half_bodans = data['o']['cs1st']['v']
  344. new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 is 1]
  345. new_one = ["halfbodanhome_one_zero", "halfbodanhome_two_zero", "halfbodanhome_two_one",
  346. "halfbodanhome_three_zero", "halfbodanhome_three_one", "halfbodanhome_three_two"]
  347. new_two = ["halfbodanguest_one_zero", "halfbodanguest_two_zero", "halfbodanguest_two_one",
  348. "halfbodanguest_three_zero", "halfbodanguest_three_one", "halfbodanguest_three_two"]
  349. new_three = ["halfbodandogfall_zero_zero", "halfbodandogfall_one_one",
  350. "halfbodandogfall_two_two",
  351. "halfbodandogfall_three_three"]
  352. halfbodan = new_half_bodans[0:12]
  353. half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 0]
  354. # 队1
  355. for index, t in enumerate(new_one):
  356. bodan_data[t] = round(float(half_bodan_home[index]) - 1, 2)
  357. # 队2
  358. half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 1]
  359. for y, z in enumerate(new_two):
  360. bodan_data[z] = round(float(half_bodan_guest[y]) - 1, 2)
  361. # 和/平
  362. half_bodan_dogfall = new_half_bodans[-6:-2]
  363. for a, b in enumerate(new_three):
  364. bodan_data[b] = round(float(half_bodan_dogfall[a]) - 1, 2)
  365. # 其他
  366. bodan_data['halfbodanother'] = round(float(new_half_bodans[-1]) - 1, 2)
  367. except:
  368. pass
  369. if new_data is 12:
  370. try:
  371. home_data = data['o']['ou']['v']
  372. # 球队进球 大条件
  373. full_dict_rule['home_tema_ball_big'] = home_data[1]
  374. # 球队进球小条件
  375. full_dict_rule['home_tema_ball_small'] = home_data[3]
  376. if pt is 3:
  377. # 球队进球大赔率
  378. full_dict['home_tema_ball_big'] = round(float(home_data[5]) - 1, 2)
  379. # 球队进球小赔率
  380. full_dict['home_tema_ball_small'] = round(float(home_data[7]) - 1, 2)
  381. else:
  382. # 球队进球大赔率
  383. full_dict['home_tema_ball_big'] = home_data[5]
  384. # 球队进球小赔率
  385. full_dict['home_tema_ball_small'] = home_data[7]
  386. except:
  387. full_dict['home_tema_ball_small'] = ""
  388. full_dict_rule['home_tema_ball_small'] = ""
  389. full_dict['home_tema_ball_big'] = ""
  390. full_dict_rule['home_tema_ball_big'] = ""
  391. try:
  392. half_home_data = data['o']['ou1st']['v']
  393. half_dict_rule['half_home_tema_ball_big'] = half_home_data[1]
  394. half_dict_rule['half_home_tema_ball_small'] = half_home_data[3]
  395. if pt is 3:
  396. half_dict['half_home_tema_ball_big'] = round(float(half_home_data[5]) - 1, 2)
  397. half_dict['half_home_tema_ball_small'] = round(float(half_home_data[7]) - 1, 2)
  398. else:
  399. half_home_size_big = half_home_data[5]
  400. half_dict['half_home_tema_ball_big'] = half_home_size_big
  401. half_home_size_small = half_home_data[7]
  402. half_dict['half_home_tema_ball_small'] = half_home_size_small
  403. except:
  404. half_dict_rule['half_home_tema_ball_big'] = ""
  405. half_dict['half_home_tema_ball_big'] = ""
  406. half_dict_rule['half_home_tema_ball_small'] = ""
  407. half_dict['half_home_tema_ball_small'] = ""
  408. if new_data is 13:
  409. try:
  410. guest_data = data['o']['ou']['v']
  411. full_dict_rule['guest_tema_ball_big'] = guest_data[1]
  412. full_dict_rule['guest_tema_ball_small'] = guest_data[3]
  413. if pt is 3:
  414. full_dict['guest_tema_ball_big'] = round(float(guest_data[5]) - 1, 2)
  415. full_dict['guest_tema_ball_small'] = round(float(guest_data[7]) - 1, 2)
  416. else:
  417. full_dict['guest_tema_ball_big'] = guest_data[5]
  418. full_dict['guest_tema_ball_small'] = guest_data[7]
  419. except:
  420. full_dict_rule['guest_tema_ball_big'] = ""
  421. full_dict['guest_tema_ball_big'] = ""
  422. full_dict_rule['guest_tema_ball_small'] = ""
  423. full_dict['guest_tema_ball_small'] = ''
  424. try:
  425. half_guest_data = data['o']['ou1st']['v']
  426. half_dict_rule['half_guest_tema_ball_big'] = half_guest_data[1]
  427. half_dict_rule['half_guest_tema_ball_small'] = half_guest_data[3]
  428. if pt is 3:
  429. half_dict['half_guest_tema_ball_big'] = round(float(half_guest_data[5]) - 1, 2)
  430. half_dict['half_guest_tema_ball_small'] = round(float(half_guest_data[7]) - 1, 2)
  431. else:
  432. half_dict['half_guest_tema_ball_big'] = half_guest_data[5]
  433. half_dict['half_guest_tema_ball_small'] = half_guest_data[7]
  434. except:
  435. half_dict_rule['half_guest_tema_ball_big'] = ""
  436. half_dict['half_guest_tema_ball_big'] = ""
  437. half_dict_rule['half_guest_tema_ball_small'] = ""
  438. half_dict['half_guest_tema_ball_small'] = ""
  439. item['league_id'] = league_id
  440. item['league_name'] = league_name
  441. item['pt'] = pt
  442. item['game_id'] = game_id
  443. item['team_home'] = team_home
  444. item['team_guest'] = team_guest
  445. item['number'] = number
  446. item['data_game'] = data_game
  447. item['time_game'] = time_game
  448. item['corner_ball'] = corner_ball
  449. # 波胆
  450. item['bodan_data'] = bodan_data
  451. # 早盘入球数单双
  452. item["odd_even_odd"] = odd_even_odd
  453. item["odd_even_even"] = odd_even_even
  454. item["half_odd_even_odd"] = half_odd_even_odd
  455. item["half_odd_even_even"] = half_odd_even_even
  456. item['total_goal'] = total_goal
  457. item["half_capot_home"] = half_capot_home
  458. item["half_capot_guest"] = half_capot_guest
  459. item["half_capot_dogfall"] = half_capot_dogfall
  460. item["capot_home"] = capot_home
  461. item["capot_guest"] = capot_guest
  462. item["capot_dogfall"] = capot_dogfall
  463. item["first_last_ball"] = first_last_ball
  464. item["half_full"] = half_full
  465. item["half_size_guest"] = half_size_guest
  466. item["half_size_guest_rule"] = half_size_guest_rule
  467. item["half_size_home"] = half_size_home
  468. item["half_size_home_rule"] = half_size_home_rule
  469. # 全场大小
  470. item["size_guest"] = size_guest
  471. item["size_guest_rule"] = size_guest_rule
  472. item["size_home"] = size_home
  473. item["size_home_rule"] = size_home_rule
  474. # 上半场让球
  475. item["half_concede_home_rule"] = half_concede_home_rule
  476. item["half_concede_home"] = half_concede_home
  477. item["half_concede_guest_rule"] = half_concede_guest_rule
  478. item["half_concede_guest"] = half_concede_guest
  479. # 全场让球
  480. item["concede_guest"] = concede_guest
  481. item["concede_guest_rule"] = concede_guest_rule
  482. item["concede_home"] = concede_home
  483. item["concede_home_rule"] = concede_home_rule
  484. item['full_data'] = full_dict
  485. item['half_data'] = half_dict
  486. item['full_data_rule'] = full_dict_rule
  487. item['half_data_rule'] = half_dict_rule
  488. item['zuqiu'] = zuqiu
  489. yield item