roll_lanqiu.py 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. # -*- coding: utf-8 -*-
  2. import datetime
  3. import json
  4. # import jsonpath
  5. import scrapy
  6. from scrapy.http import Request
  7. from ..items import Roll_Lanqiu
  8. def rangqiu_daxiao(inner):
  9. concede = [inner[i] for i in range(len(inner)) if i % 2 == 1]
  10. # 主队让球条件赔率
  11. concedehome = [concede[i] for i in range(len(concede)) if i % 2 == 0]
  12. # 客队让球条件赔率
  13. concedeguest = [concede[i] for i in range(len(concede)) if i % 2 == 1]
  14. # 主队让球条件
  15. concede_home_rule = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 0]
  16. # 主队让球赔率
  17. concede_home = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 1]
  18. # 客队让球条件
  19. concede_guest_rule = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 0]
  20. # 客队让球赔率
  21. concede_guest = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 1]
  22. return concede_home_rule, concede_home, concede_guest_rule, concede_guest
  23. def danshaung_fun(inner):
  24. odd_even = [inner[i] for i in range(len(inner)) if i % 2 == 1]
  25. # 全场 总分单
  26. odd_even_odd = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 0]
  27. # 全场 总分双
  28. odd_even_even = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 1]
  29. return odd_even_odd, odd_even_even
  30. class LanqiuSpider(scrapy.Spider):
  31. name = "roll_lanqiu"
  32. to_day = datetime.datetime.now()
  33. allowed_domains = ['hg3535z.com']
  34. start_urls = ['https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/2/pt/4/ubt/am/pn/0/sb/2/dc/null/pid/0']
  35. #
  36. # https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/2/pt/4/ubt/am/pn/0/sb/2/dc/null/pid/0
  37. custom_settings = {
  38. "ITEM_PIPELINES": {
  39. "hg3535.pipeline.roll_lanqiu.Roll_Lanqiupipeline": 200,
  40. },
  41. # 'LOG_LEVEL': 'DEBUG',
  42. # 'LOG_FILE': "../hg3535/log/roll_lanqiu_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day)
  43. }
  44. def parse(self, response):
  45. responses = json.loads(response.text)
  46. try:
  47. datas = responses["i-ot"]
  48. except:
  49. print("暂无滚球篮球数据")
  50. return
  51. if datas:
  52. for data in datas:
  53. egs = data['egs']
  54. for es in egs:
  55. es = es['es']
  56. for e in es:
  57. match_id = str(e['i'][16])
  58. url = 'https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/true/ubt/am/isp/false'.format(match_id)
  59. yield Request(url=url, callback=self.parse_other, dont_filter=True)
  60. def parse_other(self, response):
  61. new_datas = json.loads(response.text).get('eg', "")
  62. item = Roll_Lanqiu()
  63. if new_datas:
  64. # 联赛id
  65. league_id = new_datas.get("c", "").get("k", "")
  66. # 联赛名
  67. league_name = new_datas.get("c", "").get("n", "")
  68. new_data = new_datas.get("es", "")
  69. result = new_data[0]
  70. # 比赛id
  71. game_id = str(result['k'])
  72. # 球队1
  73. team_home = result['i'][0]
  74. # 球队2
  75. team_guest = result['i'][1]
  76. # 数量(97>)
  77. number = result['i'][2]
  78. # 比赛状态
  79. zhuangtai = result['i'][3]
  80. # 日期
  81. data_game = result['i'][4]
  82. # 开赛时间 滚球实际只有一个进行时间
  83. # time_game = result['i'][5]
  84. time_game = result['sb']['ct']
  85. # 队1分数
  86. score_home1 = result['i'][10]
  87. # 队2分数
  88. score_guest1 = result['i'][11]
  89. # 第几节
  90. jijie = result['i'][12]
  91. # 球队得分
  92. qiudui = result['pci'].get('ctn', "")
  93. # ----------------------------------------让球分割线---------------------------------------------------------------------------
  94. concedes_dict = {}
  95. concedes_dict_rule = {}
  96. try:
  97. concedes = result['o']["ah"]["v"]
  98. # print(concedes)
  99. # 主队让球条件,主队让球赔率,客队让球条件,客队让球赔率
  100. concede_home_rule, concede_home, concede_guest_rule, concede_guest = rangqiu_daxiao(inner=concedes)
  101. concedes_dict_rule['coh'] = concede_home_rule
  102. concedes_dict['coh'] = concede_home
  103. concedes_dict_rule['cog'] = concede_guest_rule
  104. concedes_dict['cog'] = concede_guest
  105. except:
  106. concedes_dict_rule['coh'] = ""
  107. concedes_dict['coh'] = ""
  108. concedes_dict_rule['cog'] = ""
  109. concedes_dict['cog'] = ""
  110. # print(concedes_dict)
  111. try:
  112. half_concedes = result['o']["ah1st"]["v"]
  113. # 上半场 主队让球条件
  114. half_concede_home_rule, half_concede_home, half_concede_guest_rule, half_concede_guest = rangqiu_daxiao(inner=half_concedes)
  115. concedes_dict_rule['coh_h'] = half_concede_home_rule
  116. concedes_dict['coh_h'] = half_concede_home
  117. concedes_dict_rule['cog_h'] = half_concede_guest_rule
  118. concedes_dict['cog_h'] = half_concede_guest
  119. except:
  120. concedes_dict_rule['coh_h'] = ""
  121. concedes_dict['coh_h'] = ""
  122. concedes_dict_rule['cog_h'] = ""
  123. concedes_dict['cog_h'] = ""
  124. # 第一节让球
  125. try:
  126. one_concedes = result['o']["ahq1"]["v"]
  127. one_concede_home_rule, one_concede_home, one_concede_guest_rule, one_concede_guest = rangqiu_daxiao(inner=one_concedes)
  128. concedes_dict_rule['coh_1'] = one_concede_home_rule
  129. concedes_dict['coh_1'] = one_concede_home
  130. concedes_dict_rule['cog_1'] = one_concede_guest_rule
  131. concedes_dict['cog_1'] = one_concede_guest
  132. except:
  133. concedes_dict_rule['coh_1'] = ""
  134. concedes_dict['coh_1'] = ""
  135. concedes_dict_rule['cog_1'] = ""
  136. concedes_dict['cog_1'] = ""
  137. # 第二节让球
  138. try:
  139. two_concedes = result['o']["ahq2"]["v"]
  140. two_concede_home_rule, two_concede_home, two_concede_guest_rule, two_concede_guest = rangqiu_daxiao(inner=two_concedes)
  141. concedes_dict_rule['coh_2'] = two_concede_home_rule
  142. concedes_dict['coh_2'] = two_concede_home
  143. concedes_dict_rule['cog_2'] = two_concede_guest_rule
  144. concedes_dict['cog_2'] = two_concede_guest
  145. except:
  146. concedes_dict_rule['coh_2'] = ""
  147. concedes_dict['coh_2'] = ""
  148. concedes_dict_rule['cog_2'] = ""
  149. concedes_dict['cog_2'] = ""
  150. # 第三节让球
  151. try:
  152. three_concedes = result['o']["ahq3"]["v"]
  153. three_concede_home_rule, three_concede_home, three_concede_guest_rule, three_concede_guest = rangqiu_daxiao(inner=three_concedes)
  154. concedes_dict_rule['coh_3'] = three_concede_home_rule
  155. concedes_dict['coh_3'] = three_concede_home
  156. concedes_dict_rule['cog_3'] = three_concede_guest_rule
  157. concedes_dict['cog_3'] = three_concede_guest
  158. except:
  159. concedes_dict_rule['coh_3'] = ""
  160. concedes_dict['coh_3'] = ""
  161. concedes_dict_rule['cog_3'] = ""
  162. concedes_dict['cog_3'] = ""
  163. # 第四节让球
  164. try:
  165. four_concedes = result['o']["ahq4"]["v"]
  166. four_concede_home_rule, four_concede_home, four_concede_guest_rule, four_concede_guest = rangqiu_daxiao(inner=four_concedes)
  167. concedes_dict_rule['coh_4'] = four_concede_home_rule
  168. concedes_dict['coh_4'] = four_concede_home
  169. concedes_dict_rule['cog_4'] = four_concede_guest_rule
  170. concedes_dict['cog_4'] = four_concede_guest
  171. except:
  172. concedes_dict_rule['coh_4'] = ""
  173. concedes_dict['coh_4'] = ""
  174. concedes_dict_rule['cog_4'] = ""
  175. concedes_dict['cog_4'] = ""
  176. # ----------------------------------------总分大小分割线 - ---------------------------------------------------------------
  177. # 全场总分大小
  178. total_sizes_dict = {}
  179. total_sizes_dict_rule = {}
  180. try:
  181. total_sizes = result['o']["ou"]["v"]
  182. total_sizes_big_rule, total_sizes_big, total_sizes_small_rule, total_sizes_small = rangqiu_daxiao(inner=total_sizes)
  183. total_sizes_dict_rule["tnb"] = total_sizes_big_rule
  184. total_sizes_dict["tnb"] = total_sizes_big
  185. total_sizes_dict_rule["tns"] = total_sizes_small_rule
  186. total_sizes_dict["tns"] = total_sizes_small
  187. except:
  188. total_sizes_dict_rule["tnb"] = ""
  189. total_sizes_dict["tnb"] = ""
  190. total_sizes_dict_rule["tns"] = ""
  191. total_sizes_dict["tns"] = ""
  192. # 上半场总分大小
  193. try:
  194. half_total_sizes = result['o']["ou1st"]["v"]
  195. half_total_sizes_big_rule, half_total_sizes_big, half_total_sizes_small_rule, half_total_sizes_small = rangqiu_daxiao(
  196. inner=half_total_sizes)
  197. total_sizes_dict_rule["tnb_h"] = half_total_sizes_big_rule
  198. total_sizes_dict["tnb_h"] = half_total_sizes_big
  199. total_sizes_dict_rule["tns_h"] = half_total_sizes_small_rule
  200. total_sizes_dict["tns_h"] = half_total_sizes_small
  201. except:
  202. total_sizes_dict_rule["tnb_h"] = ""
  203. total_sizes_dict["tnb_h"] = ""
  204. total_sizes_dict_rule["tns_h"] = ""
  205. total_sizes_dict["tns_h"] = ""
  206. # 第一节总分大小
  207. try:
  208. one_total_sizes = result['o']["ou1st"]["v"]
  209. one_total_sizes_big_rule, one_total_sizes_big, one_total_sizes_small_rule, one_total_sizes_small = rangqiu_daxiao(
  210. inner=one_total_sizes)
  211. total_sizes_dict_rule["tnb_1"] = one_total_sizes_big_rule
  212. total_sizes_dict["tnb_1"] = one_total_sizes_big
  213. total_sizes_dict_rule["tns_1"] = one_total_sizes_small_rule
  214. total_sizes_dict["tns_1"] = one_total_sizes_small
  215. except:
  216. total_sizes_dict_rule["tnb_1"] = ""
  217. total_sizes_dict["tnb_1"] = ""
  218. total_sizes_dict_rule["tns_1"] = ""
  219. total_sizes_dict["tns_1"] = ""
  220. # 第二节场总分大小
  221. try:
  222. two_total_sizes = result['o']["ou2st"]["v"]
  223. two_total_sizes_big_rule, two_total_sizes_big, two_total_sizes_small_rule, two_total_sizes_small = rangqiu_daxiao(
  224. inner=two_total_sizes)
  225. total_sizes_dict_rule["tnb_2"] = two_total_sizes_big_rule
  226. total_sizes_dict["tnb_2"] = two_total_sizes_big
  227. total_sizes_dict_rule["tns_2"] = two_total_sizes_small_rule
  228. total_sizes_dict["tns_2"] = two_total_sizes_small
  229. except:
  230. total_sizes_dict_rule["tnb_2"] = ""
  231. total_sizes_dict["tnb_2"] = ""
  232. total_sizes_dict_rule["tns_2"] = ""
  233. total_sizes_dict["tns_2"] = ""
  234. # 第三节总分大小
  235. try:
  236. three_total_sizes = result['o']["ou3st"]["v"]
  237. three_total_sizes_big_rule, three_total_sizes_big, three_total_sizes_small_rule, three_total_sizes_small = rangqiu_daxiao(
  238. inner=three_total_sizes)
  239. total_sizes_dict_rule["tnb_3"] = three_total_sizes_big_rule
  240. total_sizes_dict["tnb_3"] = three_total_sizes_big
  241. total_sizes_dict_rule["tns_3"] = three_total_sizes_small_rule
  242. total_sizes_dict["tns_3"] = three_total_sizes_small
  243. except:
  244. total_sizes_dict_rule["tnb_3"] = ""
  245. total_sizes_dict["tnb_3"] = ""
  246. total_sizes_dict_rule["tns_3"] = ""
  247. total_sizes_dict["tns_3"] = ""
  248. # 第四节总分大小
  249. try:
  250. four_total_sizes = result['o']["ou4st"]["v"]
  251. four_total_sizes_big_rule, four_total_sizes_big, four_total_sizes_small_rule, four_total_sizes_small = rangqiu_daxiao(
  252. inner=four_total_sizes)
  253. total_sizes_dict_rule["tnb_4"] = four_total_sizes_big_rule
  254. total_sizes_dict["tnb_4"] = four_total_sizes_big
  255. total_sizes_dict_rule["tns_4"] = four_total_sizes_small_rule
  256. total_sizes_dict["tns_4"] = four_total_sizes_small
  257. except:
  258. total_sizes_dict_rule["tnb_4"] = ""
  259. total_sizes_dict["tnb_4"] = ""
  260. total_sizes_dict_rule["tns_4"] = ""
  261. total_sizes_dict["tns_4"] = ""
  262. # ----------------------------------------总分单双分割线------------------------------------------------------------------
  263. # 全场 总分单双
  264. odd_evens_dict = {}
  265. odd_evens_dict_rule = {}
  266. try:
  267. odd_evens = result['o']["oe"]["v"]
  268. # 全场 总分单, 全场 总分双
  269. odd_evens_dict["tss"] = odd_evens[1]
  270. odd_evens_dict_rule['tss'] = '单'
  271. odd_evens_dict["tsd"] = odd_evens[3]
  272. odd_evens_dict_rule['tsd'] = '双'
  273. except:
  274. odd_evens_dict["tss"] = ""
  275. odd_evens_dict_rule['tss'] = '单'
  276. odd_evens_dict["tsd"] = ""
  277. odd_evens_dict_rule['tsd'] = '双'
  278. # 上半场全场 总分单双
  279. try:
  280. half_odd_evens = result['o']["oe1st"]["v"]
  281. # 上半场 总分单, 上半场 总分双
  282. odd_evens_dict["tss_h"] = half_odd_evens[1]
  283. odd_evens_dict_rule['tss_h'] = '单'
  284. odd_evens_dict["tsd_h"] = half_odd_evens[3]
  285. odd_evens_dict_rule['tsd_h'] = '双'
  286. except:
  287. # half_odd_even_odd = ""
  288. # half_odd_even_even = ""
  289. odd_evens_dict["tss_h"] = ""
  290. odd_evens_dict_rule['tss_h'] = '单'
  291. odd_evens_dict["tsd_h"] = ""
  292. odd_evens_dict_rule['tsd_h'] = '双'
  293. # 总分:单/双-第一节
  294. try:
  295. one_odd_evens = result['o']["oeq1"]["v"]
  296. odd_evens_dict["tss_1"] = one_odd_evens[1]
  297. odd_evens_dict_rule['tss_1'] = '单'
  298. odd_evens_dict["tsd_1"] = one_odd_evens[3]
  299. odd_evens_dict_rule['tsd_1'] = '双'
  300. except:
  301. odd_evens_dict["tss_1"] = ""
  302. odd_evens_dict_rule['tss_1'] = '单'
  303. odd_evens_dict["tsd_1"] = ""
  304. odd_evens_dict_rule['tsd_1'] = '双'
  305. # 总分:单/双-第二节
  306. try:
  307. two_odd_evens = result['o']["oeq2"]["v"]
  308. odd_evens_dict["tss_2"] = two_odd_evens[1]
  309. odd_evens_dict_rule['tss_2'] = '单'
  310. odd_evens_dict["tsd_2"] = two_odd_evens[3]
  311. odd_evens_dict_rule['tsd_2'] = '双'
  312. except:
  313. # two_odd_even_odd = ""
  314. # two_odd_even_even = ""
  315. odd_evens_dict["tss_2"] = ""
  316. odd_evens_dict_rule['tss_2'] = '单'
  317. odd_evens_dict["tsd_2"] = ""
  318. odd_evens_dict_rule['tsd_2'] = '双'
  319. # 总分:单/双-第三节
  320. try:
  321. three_odd_evens = result['o']["oeq3"]["v"]
  322. odd_evens_dict["tss_3"] = three_odd_evens[1]
  323. odd_evens_dict_rule['tss_3'] = '单'
  324. odd_evens_dict["tsd_3"] = three_odd_evens[3]
  325. odd_evens_dict_rule['tsd_3'] = '双'
  326. except:
  327. odd_evens_dict["tss_3"] = ""
  328. odd_evens_dict_rule['tss_3'] = '单'
  329. odd_evens_dict["tsd_3"] = ""
  330. odd_evens_dict_rule['tsd_3'] = '双'
  331. # 总分:单/双-第四节
  332. try:
  333. four_odd_evens = result['o']["oeq4"]["v"]
  334. odd_evens_dict["tss_4"] = four_odd_evens[1]
  335. odd_evens_dict_rule['tss_4'] = '单'
  336. odd_evens_dict["tsd_4"] = four_odd_evens[3]
  337. odd_evens_dict_rule['tsd_4'] = '双'
  338. except:
  339. odd_evens_dict["tss_4"] = ""
  340. odd_evens_dict_rule['tss_4'] = '单'
  341. odd_evens_dict["tsd_4"] = ""
  342. odd_evens_dict_rule['tsd_4'] = '双'
  343. # ----------------------------------------球队得分最后一位数分割线---------------------------------------------------------
  344. # 球队得分最后一位数 主队
  345. last_numbers_dict = {}
  346. try:
  347. last_numbers = result["p-o"][0]['o']
  348. last_home = {}
  349. for last_number in last_numbers:
  350. last_home[last_number[0]] = last_number[2]
  351. except:
  352. last_home = {}
  353. last_numbers_dict["last_home"] = last_home
  354. # 球队得分最后一位数 客队
  355. try:
  356. new_last_numbers = result["p-o"][1]['o']
  357. last_guest = {}
  358. for new_last_number in new_last_numbers:
  359. last_guest[new_last_number[0]] = new_last_number[2]
  360. except:
  361. last_guest = {}
  362. last_numbers_dict["last_guest"] = last_guest
  363. # ------------------------------------------------------独赢分割线---------------------------------------------------------
  364. capots_dict = {}
  365. # 独赢
  366. try:
  367. capots = result['o']["ml"]["v"]
  368. capot_list = [capots[i] for i in range(len(capots)) if i % 2 == 1]
  369. capot_home = capot_list[0]
  370. capot_guest = capot_list[1]
  371. capots_dict["ch"] = capot_home
  372. capots_dict["cg"] = capot_guest
  373. except:
  374. capots_dict["ch"] = ""
  375. capots_dict["cg"] = ""
  376. # 上半场独赢
  377. try:
  378. half_capots = result['o']["ml1st"]["v"]
  379. half_capot_list = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
  380. half_capot_home = half_capot_list[0]
  381. half_capot_guest = half_capot_list[1]
  382. capots_dict["ch_h"] = half_capot_home
  383. capots_dict["cg_h"] = half_capot_guest
  384. except:
  385. capots_dict["ch_h"] = ""
  386. capots_dict["cg_h"] = ""
  387. # 第一节独赢
  388. try:
  389. one_capots = result['o']["mlq1"]["v"]
  390. one_capot_list = [one_capots[i] for i in range(len(one_capots)) if i % 2 == 1]
  391. one_capot_home = one_capot_list[0]
  392. one_capot_guest = one_capot_list[1]
  393. capots_dict["ch_1"] = one_capot_home
  394. capots_dict["cg_1"] = one_capot_guest
  395. except:
  396. capots_dict["ch_1"] = ""
  397. capots_dict["cg_1"] = ""
  398. # 第二节独赢
  399. try:
  400. two_capots = result['o']["mlq2"]["v"]
  401. two_capot_list = [two_capots[i] for i in range(len(two_capots)) if i % 2 == 1]
  402. two_capot_home = two_capot_list[0]
  403. two_capot_guest = two_capot_list[1]
  404. capots_dict["ch_2"] = two_capot_home
  405. capots_dict["cg_2"] = two_capot_guest
  406. except:
  407. capots_dict["ch_2"] = ""
  408. capots_dict["cg_2"] = ""
  409. # 第三节独赢
  410. try:
  411. three_capots = result['o']["mlq3"]["v"]
  412. three_capot_list = [three_capots[i] for i in range(len(three_capots)) if i % 2 == 1]
  413. three_capot_home = three_capot_list[0]
  414. three_capot_guest = three_capot_list[1]
  415. capots_dict["ch_3"] = three_capot_home
  416. capots_dict["cg_3"] = three_capot_guest
  417. except:
  418. capots_dict["ch_3"] = ""
  419. capots_dict["cg_3"] = ""
  420. # 第四节独赢
  421. try:
  422. four_capots = result['o']["mlq2"]["v"]
  423. four_capot_list = [four_capots[i] for i in range(len(four_capots)) if i % 2 == 1]
  424. four_capot_home = four_capot_list[0]
  425. four_capot_guest = four_capot_list[1]
  426. capots_dict["ch_4"] = four_capot_home
  427. capots_dict["cg_4"] = four_capot_guest
  428. except:
  429. capots_dict["ch_4"] = ""
  430. capots_dict["cg_4"] = ""
  431. # ---------------------------------------------------华丽分割线列表es[1]--------------------------------------------------
  432. # 球队得分大/小 全场主队 home
  433. team_scores_dict = {}
  434. team_scores_dict_rule = {}
  435. try:
  436. score_home = new_data[1]
  437. except:
  438. score_home = ""
  439. if score_home:
  440. try:
  441. score_homes = score_home["o"]["ou"]['v']
  442. score_home_big_rule, score_home_big, score_home_small_rule, score_home_small = rangqiu_daxiao(inner=score_homes)
  443. team_scores_dict_rule["tbhb"] = score_home_big_rule
  444. team_scores_dict["tbhb"] = score_home_big
  445. team_scores_dict_rule["tbhs"] = score_home_small_rule
  446. team_scores_dict["tbhs"] = score_home_small
  447. except:
  448. team_scores_dict_rule["tbhb"] = ""
  449. team_scores_dict["tbhb"] = ""
  450. team_scores_dict_rule["tbhs"] = ""
  451. team_scores_dict["tbhs"] = ""
  452. # 球队得分 上半场主队 home
  453. try:
  454. half_score_homes = score_home['o']['ou1st']['v']
  455. # 球队得分 上半场主队 大条件
  456. half_score_home_big_rule, half_score_home_big, half_score_home_small_rule, half_score_home_small = rangqiu_daxiao(
  457. inner=half_score_homes)
  458. team_scores_dict_rule["tbhb_h"] = half_score_home_big_rule
  459. team_scores_dict["tbhb_h"] = half_score_home_big
  460. team_scores_dict_rule["tbhs_h"] = half_score_home_small_rule
  461. team_scores_dict["tbhs_h"] = half_score_home_small
  462. except:
  463. team_scores_dict_rule["tbhb_h"] = ""
  464. team_scores_dict["tbhb_h"] = ""
  465. team_scores_dict_rule["tbhs_h"] = ""
  466. team_scores_dict["tbhs_h"] = ""
  467. # 球队得分:主队-大 / 小-第一节
  468. try:
  469. one_score_homes = score_home['o']["ouq1"]["v"]
  470. one_score_home_big_rule, one_score_home_big, one_score_home_small_rule, one_score_home_small = rangqiu_daxiao(
  471. inner=one_score_homes)
  472. team_scores_dict_rule["tbhb_1"] = one_score_home_big_rule
  473. team_scores_dict["tbhb_1"] = one_score_home_big
  474. team_scores_dict_rule["tbhs_1"] = one_score_home_small_rule
  475. team_scores_dict["tbhs_1"] = one_score_home_small
  476. except:
  477. team_scores_dict_rule["tbhb_1"] = ""
  478. team_scores_dict["tbhb_1"] = ""
  479. team_scores_dict_rule["tbhs_1"] = ""
  480. team_scores_dict["tbhs_1"] = ""
  481. # 球队得分:主队-大 / 小-第二节
  482. try:
  483. two_score_homes = score_home['o']["ouq2"]["v"]
  484. two_score_home_big_rule, two_score_home_big, two_score_home_small_rule, two_score_home_small = rangqiu_daxiao(
  485. inner=two_score_homes)
  486. team_scores_dict_rule["tbhb_2"] = two_score_home_big_rule
  487. team_scores_dict["tbhb_2"] = two_score_home_big
  488. team_scores_dict_rule["tbhs_2"] = two_score_home_small_rule
  489. team_scores_dict["tbhs_2"] = two_score_home_small
  490. except:
  491. team_scores_dict_rule["tbhb_2"] = ""
  492. team_scores_dict["tbhb_2"] = ""
  493. team_scores_dict_rule["tbhs_2"] = ""
  494. team_scores_dict["tbhs_2"] = ""
  495. # 球队得分:主队-大 / 小-第三节
  496. try:
  497. three_score_homes = score_home['o']["ouq3"]["v"]
  498. three_score_home_big_rule, three_score_home_big, three_score_home_small_rule, three_score_home_small = rangqiu_daxiao(
  499. inner=three_score_homes)
  500. team_scores_dict_rule["tbhb_3"] = three_score_home_big_rule
  501. team_scores_dict["tbhb_3"] = three_score_home_big
  502. team_scores_dict_rule["tbhs_3"] = three_score_home_small_rule
  503. team_scores_dict["tbhs_3"] = three_score_home_small
  504. except:
  505. team_scores_dict_rule["tbhb_3"] = ""
  506. team_scores_dict["tbhb_3"] = ""
  507. team_scores_dict_rule["tbhs_3"] = ""
  508. team_scores_dict["tbhs_3"] = ""
  509. # 球队得分:主队-大 / 小-第四节
  510. try:
  511. four_score_homes = score_home['o']["ouq4"]["v"]
  512. four_score_home_big_rule, four_score_home_big, four_score_home_small_rule, four_score_home_small = rangqiu_daxiao(
  513. inner=four_score_homes)
  514. team_scores_dict_rule["tbhb_4"] = four_score_home_big_rule
  515. team_scores_dict["tbhb_4"] = four_score_home_big
  516. team_scores_dict_rule["tbhs_4"] = four_score_home_small_rule
  517. team_scores_dict["tbhs_4"] = four_score_home_small
  518. except:
  519. team_scores_dict_rule["tbhs_4"] = ""
  520. team_scores_dict["tbhb_4"] = ""
  521. team_scores_dict_rule["tbhs_4"] = ""
  522. team_scores_dict["tbhs_4"] = ""
  523. # ---------------------------------------------------华丽分割线列表es[2]--------------------------------------------------
  524. # 球队得分 客队 guest
  525. try:
  526. score_guest = new_data[2]
  527. except:
  528. score_guest = ""
  529. if score_guest:
  530. try:
  531. # 球队得分: 大 / 小
  532. score_guests = score_guest["o"]["ou"]['v']
  533. score_guest_big_rule, score_guest_big, score_guest_small_rule, score_guest_small = rangqiu_daxiao(inner=score_guests)
  534. team_scores_dict_rule["tbgb"] = score_guest_big_rule
  535. team_scores_dict["tbgb"] = score_guest_big
  536. team_scores_dict_rule["tbgs"] = score_guest_small_rule
  537. team_scores_dict["tbgs"] = score_guest_small
  538. except:
  539. team_scores_dict_rule["tbgb"] = ""
  540. team_scores_dict["tbgb"] = ""
  541. team_scores_dict_rule["tbgs"] = ""
  542. team_scores_dict["tbgs"] = ""
  543. # 球队得分 上半场客队 guest
  544. try:
  545. half_score_guests = score_guest["o"]['ou1st']['v']
  546. half_score_guest_big_rule, half_score_guest_big, half_score_guest_small_rule, half_score_guest_small = rangqiu_daxiao(
  547. inner=half_score_guests)
  548. team_scores_dict_rule["tbgb_h"] = half_score_guest_big_rule
  549. team_scores_dict["tbgb_h"] = half_score_guest_big
  550. team_scores_dict_rule["tbgs_h"] = half_score_guest_small_rule
  551. team_scores_dict["tbgs_h"] = half_score_guest_small
  552. except:
  553. team_scores_dict_rule["tbgb_h"] = ""
  554. team_scores_dict["tbgb_h"] = ""
  555. team_scores_dict_rule["tbgs_h"] = ""
  556. team_scores_dict["tbgs_h"] = ""
  557. # 球队得分第一节
  558. try:
  559. one_score_guests = score_guest["o"]['ouq1']['v']
  560. one_score_guest_big_rule, one_score_guest_big, one_score_guest_small_rule, one_score_guest_small = rangqiu_daxiao(
  561. inner=one_score_guests)
  562. team_scores_dict_rule["tbgb_1"] = one_score_guest_big_rule
  563. team_scores_dict["tbgb_1"] = one_score_guest_big
  564. team_scores_dict_rule["tbgs_1"] = one_score_guest_small_rule
  565. team_scores_dict["tbgs_1"] = one_score_guest_small
  566. except:
  567. team_scores_dict_rule["tbgb_1"] = ""
  568. team_scores_dict["tbgb_1"] = ""
  569. team_scores_dict_rule["tbgs_1"] = ""
  570. team_scores_dict["tbgs_1"] = ""
  571. # 球队得分第二节
  572. try:
  573. two_score_guests = score_guest["o"]['ouq2']['v']
  574. two_score_guest_big_rule, two_score_guest_big, two_score_guest_small_rule, two_score_guest_small = rangqiu_daxiao(
  575. inner=two_score_guests)
  576. team_scores_dict_rule["tbgb_2"] = two_score_guest_big_rule
  577. team_scores_dict["tbgb_2"] = two_score_guest_big
  578. team_scores_dict_rule["tbgs_2"] = two_score_guest_small_rule
  579. team_scores_dict["tbgs_2"] = two_score_guest_small
  580. except:
  581. team_scores_dict_rule["tbgb_2"] = ""
  582. team_scores_dict["tbgb_2"] = ""
  583. team_scores_dict_rule["tbgs_2"] = ""
  584. team_scores_dict["tbgs_2"] = ""
  585. # 球队得分第三节
  586. try:
  587. three_score_guests = score_guest["o"]['ouq3']['v']
  588. three_score_guest_big_rule, three_score_guest_big, three_score_guest_small_rule, three_score_guest_small = rangqiu_daxiao(
  589. inner=three_score_guests)
  590. team_scores_dict_rule["tbgb_3"] = three_score_guest_big_rule
  591. team_scores_dict["tbgb_3"] = three_score_guest_big
  592. team_scores_dict_rule["tbgs_3"] = three_score_guest_small_rule
  593. team_scores_dict["tbgs_3"] = three_score_guest_small
  594. except:
  595. team_scores_dict_rule["tbgb_3"] = ""
  596. team_scores_dict["tbgb_3"] = ""
  597. team_scores_dict_rule["tbgs_3"] = ""
  598. team_scores_dict["tbgs_3"] = ""
  599. # 球队得分第四节
  600. try:
  601. four_score_guests = score_guest["o"]['ouq4']['v']
  602. four_score_guest_big_rule, four_score_guest_big, four_score_guest_small_rule, four_score_guest_small = rangqiu_daxiao(
  603. inner=four_score_guests)
  604. team_scores_dict_rule["tbgb_4"] = four_score_guest_big_rule
  605. team_scores_dict["tbgb_4"] = four_score_guest_big
  606. team_scores_dict_rule["tbgs_4"] = four_score_guest_small_rule
  607. team_scores_dict["tbgs_4"] = four_score_guest_small
  608. except:
  609. team_scores_dict_rule["tbgb_4"] = ""
  610. team_scores_dict["tbgb_4"] = ""
  611. team_scores_dict_rule["tbgs_4"] = ""
  612. team_scores_dict["tbgs_4"] = ""
  613. # 联赛id
  614. item['league_id'] = league_id
  615. # 联赛名
  616. item['league_name'] = league_name
  617. # item['result'] = result
  618. # 比赛id
  619. item['game_id'] = game_id
  620. # 球队1
  621. item['team_home'] = team_home
  622. # 球队2
  623. item['team_guest'] = team_guest
  624. # 数量(97>)
  625. item['number'] = number
  626. # 比赛状态
  627. item['zhuangtai'] = zhuangtai
  628. # 日期
  629. item['data_game'] = data_game
  630. # 开赛时间
  631. item['time_game'] = time_game
  632. # 队1分数
  633. item['score_home'] = score_home1
  634. # 队2分数
  635. item['score_guest'] = score_guest1
  636. # 第几节
  637. item['jijie'] = jijie
  638. # 球队得分
  639. item['qiudui'] = qiudui
  640. item['concede'] = concedes_dict
  641. item['concede_rule'] = concedes_dict_rule
  642. item['odd_even'] = odd_evens_dict
  643. item['odd_even_rule'] = odd_evens_dict_rule
  644. item['total_size'] = total_sizes_dict
  645. item['total_size_rule'] = total_sizes_dict_rule
  646. item['last_number'] = last_numbers_dict
  647. item['capot'] = capots_dict
  648. item['team_score'] = team_scores_dict
  649. item['team_score_rule'] = team_scores_dict_rule
  650. yield item