zuqiu.py 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. # -*- coding: utf-8 -*-
  2. import copy
  3. import json
  4. # import redis
  5. import time
  6. import redis
  7. import scrapy
  8. from scrapy.http import Request
  9. from ..items import Zuqiu
  10. import datetime
  11. class ZuqiuSpider(scrapy.Spider):
  12. name = 'zuqiu'
  13. to_day = datetime.datetime.now()
  14. # print(to_day.year, to_day)
  15. allowed_domains = ['hg3535z.com']
  16. custom_settings = {
  17. "ITEM_PIPELINES": {
  18. 'hg3535.pipeline.zuqiu.Zuqiupipeline': 300,
  19. },
  20. # 'LOG_LEVEL': 'DEBUG',
  21. # 'LOG_FILE': "../hg3535/log/zuqiu_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day),
  22. # 'RETRY_ENABLED': False,
  23. # 'COOKIES_ENABLED': False,
  24. # 'DOWNLOAD_TIMEOUT': 1,
  25. # 'SCHEDULER_PERSIST': False,
  26. # 'SCHEDULER_FLUSH_ON_START': False,
  27. }
  28. rls = redis.Redis(host='192.168.2.200', port=6379, db=1, password=123456)
  29. def start_requests(self):
  30. for y in range(1, 4):
  31. for i in range(10):
  32. y = str(y)
  33. i = str(i)
  34. # yield y
  35. url = "https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/1/pt/" + y + "/ubt/am/pn/" + i + "/sb/2/dc/null/pid/0"
  36. yield scrapy.Request(url=url, callback=self.parse, dont_filter=True, meta={'pt': y})
  37. def parse(self, response):
  38. if response.status == 200:
  39. # cls = redis.Redis(host='192.168.0.110', port=6379, db=0)
  40. if response.text:
  41. try:
  42. datas = json.loads(response.text).get('n-ot', "").get('egs', "")
  43. except:
  44. # datas = ''
  45. print("为获取到数据")
  46. return
  47. pt = copy.copy(response.meta['pt'])
  48. for result in datas:
  49. new_results = result['es']
  50. for new_result in new_results:
  51. game_id = new_result['k']
  52. # cls.sadd('hg3535.zq.ids', game_id)
  53. # cls.expire('hg3535.zq.ids', 300)
  54. if pt == "3":
  55. local_time = time.time()
  56. self.rls.hset('hg3535.chuanchang.ids', game_id, local_time)
  57. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/true".format(game_id)
  58. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  59. if pt == "2":
  60. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/false".format(game_id)
  61. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  62. if pt == "1":
  63. url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/false".format(game_id)
  64. yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
  65. #
  66. def parse_each(self, response):
  67. if response.status == 200:
  68. # 球队进球数 大小
  69. try:
  70. datas = json.loads(response.text)['eg']['es']
  71. league_id = json.loads(response.text)['eg']['c']['k']
  72. # 联赛名
  73. league_name = json.loads(response.text)['eg']['c']['n']
  74. # zuqiu = json.loads(response.text)['i'][31]
  75. except:
  76. datas = ""
  77. league_id = ""
  78. # 联赛名
  79. league_name = ""
  80. # zuqiu = ""
  81. try:
  82. pt = response.meta['pt']
  83. except:
  84. pt = 0
  85. if datas:
  86. item = Zuqiu()
  87. full_dict = {}
  88. half_dict = {}
  89. full_dict_rule = {}
  90. half_dict_rule = {}
  91. horn_ou_dict = {}
  92. horn_ou_dict_rule = {}
  93. horn_oe_dict = {}
  94. horn_oe_dict_rule = {}
  95. horn_team = {}
  96. for data in datas:
  97. try:
  98. ctid = data['pci']['ctid']
  99. except:
  100. ctid = ""
  101. if ctid == 0:
  102. # 比赛id
  103. game_id = str(data['k'])
  104. # 球队1
  105. team_home = data['i'][0]
  106. # 球队2
  107. team_guest = data['i'][1]
  108. # 数量(97>)
  109. number = data['i'][2]
  110. # 下半场
  111. half_way = data['i'][12]
  112. # 角球或者其他
  113. try:
  114. corner_ball = data['pci']['ctn']
  115. except:
  116. corner_ball = 0
  117. # 日期
  118. data_game = data['i'][4]
  119. # 开赛时间
  120. time_game = data['i'][5]
  121. # 让球------------------------------------------------------------------------------------------------------------------
  122. try:
  123. concedes = data['o']['ah']['v']
  124. new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 is 1]
  125. concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 0]
  126. concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 0]
  127. # concede_home
  128. concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 1]
  129. # concede_guest_rule
  130. concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if
  131. i % 2 == 0]
  132. if pt is 3:
  133. concede_guest = [round(float(concede_guests[i]) - 1, 2) for i in range(len(concede_guests)) if i % 2 is 1]
  134. concede_home = [round(float(concede_homes[i]) - 1, 2) for i in range(len(concede_homes)) if i % 2 is 1]
  135. else:
  136. concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 is 1]
  137. concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 1]
  138. except:
  139. concede_guest = ""
  140. concede_guest_rule = ""
  141. concede_home = ""
  142. concede_home_rule = ""
  143. # 上半场让球half_concede-------------------------------------------------------------------------------------------------
  144. try:
  145. half_concedes = data['o']['ah1st']['v']
  146. new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 is 1]
  147. new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 0]
  148. # half_concede_home_rule
  149. half_concede_home_rule = [new_half_concede_homes[i] for i in
  150. range(len(new_half_concede_homes)) if i % 2 == 0]
  151. # concede_home
  152. half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 is 1]
  153. # concede_guest_rule
  154. half_concede_guest_rule = [half_concede_guests[i] for i in
  155. range(len(half_concede_guests)) if i % 2 == 0]
  156. if pt is 3:
  157. half_concede_home = [round(float(new_half_concede_homes[i]) - 1, 2) for i in range(len(new_half_concede_homes)) if
  158. i % 2 is 1]
  159. half_concede_guest = [round(float(half_concede_guests[i]) - 1, 2) for i in range(len(half_concede_guests)) if
  160. i % 2 is 1]
  161. else:
  162. half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 is 1]
  163. half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 is 1]
  164. except:
  165. half_concede_home_rule = ""
  166. half_concede_home = ""
  167. half_concede_guest_rule = ""
  168. half_concede_guest = ""
  169. # 全场大小size 进球大小---------------------------------------------------------------------------------------------------
  170. try:
  171. sizes = data['o']['ou']['v']
  172. new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 is 1]
  173. size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 0]
  174. # size_home_rule
  175. size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 0]
  176. # size_home
  177. size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 1]
  178. # size_guest_rule
  179. size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 0]
  180. # csize_guest
  181. if pt is 3:
  182. size_guest = [round(float(size_guests[i]) - 1, 2) for i in range(len(size_guests)) if i % 2 is 1]
  183. size_home = [round(float(size_homes[i]) - 1, 2) for i in range(len(size_homes)) if i % 2 is 1]
  184. else:
  185. size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 1]
  186. size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 1]
  187. except:
  188. size_guest = ""
  189. size_guest_rule = ""
  190. size_home = ""
  191. size_home_rule = ""
  192. # 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
  193. try:
  194. half_sizes = data['o']['ou1st']['v']
  195. new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 is 1]
  196. half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 0]
  197. # size_home_rule
  198. half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if
  199. i % 2 is 0]
  200. half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 1]
  201. # half_size_guest_rule 客队
  202. half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if
  203. i % 2 is 0]
  204. # half_size_guest
  205. if pt is 3:
  206. half_size_guest = [round(float(half_size_guests[i]) - 1, 2) for i in range(len(half_size_guests)) if
  207. i % 2 is 1]
  208. half_size_home = [round(float(half_size_homes[i]) - 1, 2) for i in range(len(half_size_homes)) if
  209. i % 2 is 1]
  210. else:
  211. half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if
  212. i % 2 is 1]
  213. half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 is 1]
  214. except:
  215. half_size_guest = ""
  216. half_size_guest_rule = ""
  217. half_size_home = ""
  218. half_size_home_rule = ""
  219. # 全场总进球 total_goal--------------------------------------------------------------------------------------------------
  220. total_goal = {}
  221. try:
  222. total_goals = data['o']['tg']['v']
  223. new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 is 1]
  224. total_goal["tg0"] = round(float(new_total_goals[0]) - 1, 2)
  225. total_goal["tg1"] = round(float(new_total_goals[1]) - 1, 2)
  226. total_goal["tg2"] = round(float(new_total_goals[2]) - 1, 2)
  227. total_goal["tg3"] = round(float(new_total_goals[3]) - 1, 2)
  228. except:
  229. total_goal["tg0"] = ""
  230. total_goal["tg1"] = ""
  231. total_goal["tg2"] = ""
  232. total_goal["tg3"] = ""
  233. # 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
  234. try:
  235. half_total_goals = data['o']['tg1st']['v']
  236. new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 is 1]
  237. total_goal["tg0_h"] = round(float(new_half_total_goals[0]) - 1, 2)
  238. total_goal["tg1_h"] = round(float(new_half_total_goals[1]) - 1, 2)
  239. total_goal["tg2_h"] = round(float(new_half_total_goals[2]) - 1, 2)
  240. total_goal["tg3_h"] = round(float(new_half_total_goals[3]) - 1, 2)
  241. except:
  242. total_goal["tg0_h"] = ""
  243. total_goal["tg1_h"] = ""
  244. total_goal["tg2_h"] = ""
  245. total_goal["tg3_h"] = ""
  246. # 早盘 半场/全场---------------------------------------------------------------------------------------------------------
  247. half_full = {}
  248. new_lists = ["hfhh", "hfhd", "hfhg", "hfdh", "hfdd", "hfdg", "hfgh", "hfgd", "hfgg"]
  249. # 早盘 半场/全场
  250. try:
  251. half_fulls = data['o']['hf']['v']
  252. new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 is 1]
  253. for index, value in enumerate(new_lists):
  254. half_full[value] = round(float(new_half_fulls[index]) - 1, 2)
  255. except:
  256. for index, value in enumerate(new_lists):
  257. half_full[value] = ""
  258. # 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
  259. first_last_ball = {}
  260. try:
  261. first_balls = data['o']['ttslast']['v']
  262. first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 is 1]
  263. first_last_ball['flbfh'] = round(float(first_ball[0]) - 1, 2)
  264. first_last_ball['flbfg'] = round(float(first_ball[1]) - 1, 2)
  265. except:
  266. pass
  267. # 早盘 最先/最后进球 最后进球
  268. try:
  269. last_balls = data['o']['tts1st']['v']
  270. last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 is 1]
  271. first_last_ball['flblh'] = round(float(last_ball[0]) - 1, 2)
  272. first_last_ball['flblg'] = round(float(last_ball[1]) - 1, 2)
  273. first_last_ball['flbn'] = round(float(last_ball[2]) - 1, 2)
  274. except:
  275. pass
  276. # 全场独赢capot ---------------------------------------------------------------------------------------------------------
  277. try:
  278. capots = data['o']['1x2']['v']
  279. new_capots = [capots[i] for i in range(len(capots)) if i % 2 is 1]
  280. capot_home = round(float(new_capots[0]) - 1, 2)
  281. capot_guest = round(float(new_capots[1]) - 1, 2)
  282. capot_dogfall = round(float(new_capots[2]) - 1, 2)
  283. except:
  284. capot_home = ""
  285. capot_guest = ""
  286. capot_dogfall = ""
  287. # 上半场独赢capot
  288. try:
  289. half_capots = data['o']['1x21st']['v']
  290. new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 is 1]
  291. half_capot_home = round(float(new_half_capots[0]) - 1, 2)
  292. half_capot_guest = round(float(new_half_capots[1]) - 1, 2)
  293. half_capot_dogfall = round(float(new_half_capots[2]) - 1, 2)
  294. except:
  295. half_capot_home = ""
  296. half_capot_guest = ""
  297. half_capot_dogfall = ""
  298. # 全场入球:单/双 odd_even------------------------------------------------------------------------------------------------
  299. try:
  300. odd_evens = data['o']['oe']['v']
  301. new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 is 1]
  302. if pt is 3:
  303. odd_even_odd = round(float(new_odd_evens[0]) - 1, 2)
  304. odd_even_even = round(float(new_odd_evens[1]) - 1, 2)
  305. else:
  306. odd_even_odd = round(float(new_odd_evens[0]), 2)
  307. odd_even_even = round(float(new_odd_evens[1]), 2)
  308. except:
  309. odd_even_odd = ""
  310. odd_even_even = ""
  311. # 半场入球:单/双 half_odd_even
  312. try:
  313. half_odd_evens = data['o']['oe1st']['v']
  314. new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 is 1]
  315. if pt is 3:
  316. half_odd_even_odd = round(float(new_half_odd_evens[0]) - 1, 2)
  317. half_odd_even_even = round(float(new_half_odd_evens[1]) - 1, 2)
  318. else:
  319. half_odd_even_odd = new_half_odd_evens[0]
  320. half_odd_even_even = new_half_odd_evens[1]
  321. except:
  322. half_odd_even_odd = ""
  323. half_odd_even_even = ""
  324. bodan_data = {}
  325. # 波胆------------------------------------------------------------------------------------------------------------------
  326. try:
  327. bodans = data['o']['cs']['v']
  328. one_list = ["b10", "b20", "b21", "b30", "b31", "b32", "b40", "b41", "b42", "b43"]
  329. two_list = ["b01", "b02", "b12", "b03", "b13", "b23", "b04", "b14", "b24", "b34"]
  330. three_list = ["b00", "b11", "b22", "b33", "b44"]
  331. new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 is 1]
  332. new_bodan = new_bodans[0:20]
  333. # 主队bodan_home
  334. bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 0]
  335. for index, t in enumerate(one_list):
  336. bodan_data[t] = round(float(bodan_home[index]) - 1, 2)
  337. # 客队bodan_guest
  338. bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 1]
  339. for y, z in enumerate(two_list):
  340. bodan_data[z] = round(float(bodan_guest[y]) - 1, 2)
  341. bodan_dogfall = new_bodans[-6:-1]
  342. for a, b in enumerate(three_list):
  343. bodan_data[b] = round(float(bodan_dogfall[a]) - 1, 2)
  344. # 其他bodan_other
  345. bodan_data['bo'] = round(float(new_bodans[-1]) - 1, 2)
  346. except:
  347. pass
  348. try:
  349. half_bodans = data['o']['cs1st']['v']
  350. new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 is 1]
  351. new_one = ["b10_h", "b20_h", "b21_h", "b30_h", "b31_h", "b32_h"]
  352. new_two = ["b01_h", "b02_h", "b12_h", "b03_h", "b13_h", "b23_h"]
  353. new_three = ["b00_h", "b11_h", "b22_h", "b33_h"]
  354. halfbodan = new_half_bodans[0:12]
  355. half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 0]
  356. # 队1
  357. for index, t in enumerate(new_one):
  358. bodan_data[t] = round(float(half_bodan_home[index]) - 1, 2)
  359. # 队2
  360. half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 1]
  361. for y, z in enumerate(new_two):
  362. bodan_data[z] = round(float(half_bodan_guest[y]) - 1, 2)
  363. # 和/平
  364. half_bodan_dogfall = new_half_bodans[-6:-2]
  365. for a, b in enumerate(new_three):
  366. bodan_data[b] = round(float(half_bodan_dogfall[a]) - 1, 2)
  367. # 其他
  368. bodan_data['bo_h'] = round(float(new_half_bodans[-1]) - 1, 2)
  369. except:
  370. pass
  371. if ctid == 1:
  372. # 角球数据
  373. horn_team['horn_home'] = data['i'][0]
  374. horn_team['horn_guest'] = data['i'][1]
  375. horn_team['horn_scoreh'] = data['i'][10]
  376. horn_team['horn_scoreg'] = data['i'][11]
  377. horn_team['horn_id'] = str(data['k'])
  378. try:
  379. horn_ou = data['o']['ou']['v']
  380. except:
  381. horn_ou = ''
  382. if horn_ou:
  383. horn_ou_dict['cbgb'] = horn_ou[5]
  384. horn_ou_dict['cbgs'] = horn_ou[7]
  385. horn_ou_dict_rule['cbgb'] = horn_ou[1]
  386. horn_ou_dict_rule['cbgs'] = horn_ou[3]
  387. try:
  388. horn_ou1st = data['o']['ou1st']['v']
  389. except:
  390. horn_ou1st = ''
  391. if horn_ou1st:
  392. horn_ou_dict['cbgb_h'] = horn_ou1st[5]
  393. horn_ou_dict['cbgs_h'] = horn_ou1st[7]
  394. horn_ou_dict_rule['cbgb_h'] = horn_ou1st[1]
  395. horn_ou_dict_rule['cbgs_h'] = horn_ou1st[3]
  396. try:
  397. horn_oe = data['o']['oe']['v']
  398. except:
  399. horn_oe = ''
  400. if horn_oe:
  401. horn_oe_dict['cbtss'] = horn_oe[1]
  402. horn_oe_dict['cbtsd'] = horn_oe[3]
  403. horn_oe_dict_rule['cbtss'] = '单'
  404. horn_oe_dict_rule['cbtsd'] = '双'
  405. try:
  406. horn_oe1st = data['o']['oe1st']['v']
  407. except:
  408. horn_oe1st = ''
  409. if horn_oe1st:
  410. horn_oe_dict['cbtss_h'] = horn_oe1st[1]
  411. horn_oe_dict['cbtsd_h'] = horn_oe1st[3]
  412. horn_oe_dict_rule['cbtss_h'] = '单'
  413. horn_oe_dict_rule['cbtsd_h'] = '双'
  414. if ctid == 12:
  415. try:
  416. home_data = data['o']['ou']['v']
  417. # 球队进球 大条件
  418. full_dict_rule['tbhb'] = home_data[1]
  419. # 球队进球小条件
  420. full_dict_rule['tbhs'] = home_data[3]
  421. if pt is 3:
  422. # 球队进球大赔率
  423. full_dict['tbhb'] = round(float(home_data[5]) - 1, 2)
  424. # 球队进球小赔率
  425. full_dict['tbhs'] = round(float(home_data[7]) - 1, 2)
  426. else:
  427. # 球队进球大赔率
  428. full_dict['tbhb'] = home_data[5]
  429. # 球队进球小赔率
  430. full_dict['tbhs'] = home_data[7]
  431. except:
  432. full_dict['tbhs'] = ""
  433. full_dict_rule['tbhs'] = ""
  434. full_dict['tbhb'] = ""
  435. full_dict_rule['tbhb'] = ""
  436. try:
  437. half_home_data = data['o']['ou1st']['v']
  438. half_dict_rule['tbhb_h'] = half_home_data[1]
  439. half_dict_rule['tbhs_h'] = half_home_data[3]
  440. if pt is 3:
  441. half_dict['tbhb_h'] = round(float(half_home_data[5]) - 1, 2)
  442. half_dict['tbhs_h'] = round(float(half_home_data[7]) - 1, 2)
  443. else:
  444. half_dict['tbhb_h'] = half_home_data[5]
  445. half_dict['tbhs_h'] = half_home_data[7]
  446. except:
  447. half_dict_rule['tbhb_h'] = ""
  448. half_dict['tbhb_h'] = ""
  449. half_dict_rule['tbhs_h'] = ""
  450. half_dict['tbhs_h'] = ""
  451. if ctid == 13:
  452. try:
  453. guest_data = data['o']['ou']['v']
  454. full_dict_rule['tbgb'] = guest_data[1]
  455. full_dict_rule['tbgs'] = guest_data[3]
  456. if pt is 3:
  457. full_dict['tbgb'] = round(float(guest_data[5]) - 1, 2)
  458. full_dict['tbgs'] = round(float(guest_data[7]) - 1, 2)
  459. else:
  460. full_dict['tbgb'] = guest_data[5]
  461. full_dict['tbgs'] = guest_data[7]
  462. except:
  463. full_dict_rule['tbgb'] = ""
  464. full_dict['tbgb'] = ""
  465. full_dict_rule['tbgs'] = ""
  466. full_dict['tbgs'] = ''
  467. try:
  468. half_guest_data = data['o']['ou1st']['v']
  469. half_dict_rule['tbgb_h'] = half_guest_data[1]
  470. half_dict_rule['tbgs_h'] = half_guest_data[3]
  471. if pt is 3:
  472. half_dict['tbgb_h'] = round(float(half_guest_data[5]) - 1, 2)
  473. half_dict['tbgs_h'] = round(float(half_guest_data[7]) - 1, 2)
  474. else:
  475. half_dict['tbgb_h'] = half_guest_data[5]
  476. half_dict['tbgs_h'] = half_guest_data[7]
  477. except:
  478. half_dict_rule['tbgb_h'] = ""
  479. half_dict['tbgb_h'] = ""
  480. half_dict_rule['tbgs_h'] = ""
  481. half_dict['tbgs_h'] = ""
  482. item['league_id'] = league_id
  483. item['league_name'] = league_name
  484. item['pt'] = pt
  485. item['game_id'] = game_id
  486. item['team_home'] = team_home
  487. item['team_guest'] = team_guest
  488. item['number'] = number
  489. item['data_game'] = data_game
  490. item['time_game'] = time_game
  491. item['corner_ball'] = corner_ball
  492. # 波胆
  493. item['bodan_data'] = bodan_data
  494. # 早盘入球数单双
  495. item["odd_even_odd"] = odd_even_odd
  496. item["odd_even_even"] = odd_even_even
  497. item["half_odd_even_odd"] = half_odd_even_odd
  498. item["half_odd_even_even"] = half_odd_even_even
  499. item['total_goal'] = total_goal
  500. item["half_capot_home"] = half_capot_home
  501. item["half_capot_guest"] = half_capot_guest
  502. item["half_capot_dogfall"] = half_capot_dogfall
  503. item["capot_home"] = capot_home
  504. item["capot_guest"] = capot_guest
  505. item["capot_dogfall"] = capot_dogfall
  506. item["first_last_ball"] = first_last_ball
  507. item["half_full"] = half_full
  508. item["half_size_guest"] = half_size_guest
  509. item["half_size_guest_rule"] = half_size_guest_rule
  510. item["half_size_home"] = half_size_home
  511. item["half_size_home_rule"] = half_size_home_rule
  512. # 全场大小
  513. item["size_guest"] = size_guest
  514. item["size_guest_rule"] = size_guest_rule
  515. item["size_home"] = size_home
  516. item["size_home_rule"] = size_home_rule
  517. # 上半场让球
  518. item["half_concede_home_rule"] = half_concede_home_rule
  519. item["half_concede_home"] = half_concede_home
  520. item["half_concede_guest_rule"] = half_concede_guest_rule
  521. item["half_concede_guest"] = half_concede_guest
  522. # 全场让球
  523. item["concede_guest"] = concede_guest
  524. item["concede_guest_rule"] = concede_guest_rule
  525. item["concede_home"] = concede_home
  526. item["concede_home_rule"] = concede_home_rule
  527. item['full_data'] = full_dict
  528. item['half_data'] = half_dict
  529. item['full_data_rule'] = full_dict_rule
  530. item['half_data_rule'] = half_dict_rule
  531. item['horn_ou_dict'] = horn_ou_dict
  532. item['horn_ou_dict_rule'] = horn_ou_dict_rule
  533. item['horn_oe_dict'] = horn_oe_dict
  534. item['horn_oe_dict_rule'] = horn_oe_dict_rule
  535. item['horn_team'] = horn_team
  536. # item['zuqiu'] = zuqiu
  537. yield item