hg3535_zuqiu.py 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. # -*- coding: utf-8 -*-
  2. import copy
  3. import json
  4. import jsonpath
  5. import scrapy
  6. from scrapy.http import Request
  7. from ..items import Roll_Zuqiu
  8. from scrapy.spidermiddlewares.httperror import HttpError
  9. from twisted.internet.error import DNSLookupError
  10. from twisted.internet.error import TimeoutError
  11. class ZuqiuSpider(scrapy.Spider):
  12. name = 'roll_zuqiu'
  13. allowed_domains = ['hg3535z.com']
  14. custom_settings = {
  15. "ITEM_PIPELINES":{
  16. 'hg3535.pipelines.Roll_Zuqiupipeline': 100,
  17. }
  18. }
  19. # def start_requests(self):
  20. #
  21. # for y in range(1, 4):
  22. # for i in range(10):
  23. # url = 'https://hg3535z.com/odds2/d/getodds?sid=1&pt=' + str(y) + '&ubt=' + 'am' + '&pn=' + str(
  24. # i) + '&sb=2&dc=null&pid=0'
  25. # yield scrapy.Request(url=url, callback=self.parse, meta={'pt': y})
  26. start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
  27. def parse(self, response):
  28. datas = json.loads(response.text)
  29. # item = Today_all()
  30. ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
  31. print(ids)
  32. if ids:
  33. ids = set(ids)
  34. for i in ids:
  35. urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
  36. print(urls)
  37. yield Request(url=urls, callback=self.parse_each)
  38. # if response.text:
  39. # try:
  40. # datas = json.loads(response.text).get('n-ot', "").get('egs', "")
  41. # except:
  42. # datas = ""
  43. # pt = copy.copy(response.meta['pt'])
  44. # if datas:
  45. # for result in datas:
  46. # new_results = result['es']
  47. # for new_result in new_results:
  48. # game_id = str(new_result['i'][16])
  49. # if pt is 3:
  50. # url = "https://hg3535z.com/odds2/d/getamodds?eid="+game_id+"&iip=false&ubt=am&isp=true"
  51. # yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
  52. # if pt is 2:
  53. # url = "https://hg3535z.com/odds2/d/getamodds?eid="+game_id+"&iip=false&ubt=am&isp=false"
  54. # yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
  55. # if pt is 1:
  56. # url = "https://hg3535z.com/odds2/d/getamodds?eid="+game_id+"&iip=false&ubt=am&isp=false"
  57. # yield Request(url=url, callback=self.parse_each, meta={'pt': pt})
  58. # def errback_httpbin(self, failure):
  59. # # log all errback failures,
  60. # # in case you want to do something special for some errors,
  61. # # you may need the failure's type
  62. # self.logger.error(repr(failure))
  63. #
  64. # #if isinstance(failure.value, HttpError):
  65. # if failure.check(HttpError):
  66. # # you can get the response
  67. # response = failure.value.response
  68. # self.logger.error('HttpError on %s', response.url)
  69. #
  70. # #elif isinstance(failure.value, DNSLookupError):
  71. # elif failure.check(DNSLookupError):
  72. # # this is the original request
  73. # request = failure.request
  74. # self.logger.error('DNSLookupError on %s', request.url)
  75. #
  76. # #elif isinstance(failure.value, TimeoutError):
  77. # elif failure.check(TimeoutError):
  78. # request = failure.request
  79. # self.logger.error('TimeoutError on %s', request.url)
  80. def parse_each(self, response):
  81. # 球队进球数 大小
  82. try:
  83. datas = json.loads(response.text)['eg']['es']
  84. league_id = json.loads(response.text)['eg']['c']['k']
  85. # 联赛名
  86. league_name = json.loads(response.text)['eg']['c']['n']
  87. except:
  88. datas = ""
  89. league_id = ""
  90. # 联赛名
  91. league_name = ""
  92. try:
  93. pt = response.meta['pt']
  94. except:
  95. pt = 0
  96. if datas:
  97. item = Roll_Zuqiu()
  98. full_dict = {}
  99. half_dict = {}
  100. full_dict_rule = {}
  101. half_dict_rule = {}
  102. for data in datas:
  103. try:
  104. new_data = data['pci']['ctid']
  105. except:
  106. new_data = ""
  107. if new_data == 0:
  108. # 比赛id
  109. game_id = str(data['k'])
  110. # 球队1
  111. team_home = data['i'][0]
  112. # 球队2
  113. team_guest = data['i'][1]
  114. # 数量(97>)
  115. number = data['i'][2]
  116. # 下半场
  117. half_way = data['i'][12]
  118. # 角球或者其他
  119. corner_ball = data['pci'].get('ctn', "")
  120. # 日期
  121. data_game = data['i'][4]
  122. # 开赛时间
  123. time_game = data['i'][5]
  124. #这个地方的值不准确 需要再次确认
  125. score_home = data['i'][10] # 队一分数
  126. score_guest = data['i'][11] # 队二分数
  127. # half_way = new_result['i'][12] #下半场
  128. # 让球------------------------------------------------------------------------------------------------------------------
  129. try:
  130. concedes = data['o']['ah']['v']
  131. new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 == 1]
  132. concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 0]
  133. # concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 0]
  134. concede_home_rule = []
  135. for i in range(len(concede_homes)):
  136. if i % 2 is 0:
  137. home_rule = str(concede_homes[i])
  138. if home_rule.startswith('+'):
  139. n_home_rule = home_rule.replace('+', '-')
  140. concede_home_rule.append(n_home_rule)
  141. elif home_rule.startswith('-'):
  142. n_home_rule = home_rule.replace('-', '+')
  143. concede_home_rule.append(n_home_rule)
  144. else:
  145. concede_home_rule.append(home_rule)
  146. # concede_homes[i]
  147. # concede_home
  148. if pt is 3:
  149. concede_home = [float(concede_homes[i]) - 1 for i in range(len(concede_homes)) if i % 2 is 1]
  150. else:
  151. concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 1]
  152. concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 1]
  153. # concede_guest_rule
  154. # concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if
  155. # i % 2 == 0]
  156. # concede_guest
  157. concede_guest_rule = []
  158. for i in range(len(concede_guests)):
  159. if i % 2 is 0:
  160. guest_rule = str(concede_guests[i])
  161. if guest_rule.startswith('+'):
  162. n_guest_rule = guest_rule.replace('+', '-')
  163. concede_guest_rule.append(n_guest_rule)
  164. elif guest_rule.startswith('-'):
  165. n_guest_rule = guest_rule.replace('-', '+')
  166. concede_guest_rule.append(n_guest_rule)
  167. else:
  168. concede_guest_rule.append(guest_rule)
  169. if pt is 3:
  170. concede_guest = [float(concede_guests[i]) -1 for i in range(len(concede_guests)) if i % 2 is 1]
  171. else:
  172. concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 is 1]
  173. except:
  174. concede_guest = ""
  175. concede_guest_rule = ""
  176. concede_home = ""
  177. concede_home_rule = ""
  178. # 上半场让球half_concede-------------------------------------------------------------------------------------------------
  179. try:
  180. half_concedes = data['o']['ah1st']['v']
  181. new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 is 1]
  182. new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if
  183. i % 2 is 0]
  184. # half_concede_home_rule
  185. # half_concede_home_rule = [new_half_concede_homes[i] for i in
  186. # range(len(new_half_concede_homes)) if i % 2 == 0]
  187. half_concede_home_rule = []
  188. for i in range(len(new_half_concede_homes)):
  189. if i % 2 == 0:
  190. home_rule = str(new_half_concede_homes[i])
  191. if home_rule.startswith('+'):
  192. n_home_rule = home_rule.replace('+', '-')
  193. half_concede_home_rule.append(n_home_rule)
  194. if home_rule.startswith('-'):
  195. n_home_rule = home_rule.replace('-', '+')
  196. half_concede_home_rule.append(n_home_rule)
  197. else:
  198. half_concede_home_rule.append(home_rule)
  199. # concede_home
  200. if pt is 3:
  201. half_concede_home = [float(new_half_concede_homes[i]) - 1 for i in range(len(new_half_concede_homes)) if i % 2 is 1]
  202. else:
  203. half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 is 1]
  204. half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 is 1]
  205. # concede_guest_rule
  206. # half_concede_guest_rule = [half_concede_guests[i] for i in
  207. # range(len(half_concede_guests)) if i % 2 == 0]
  208. half_concede_guest_rule = []
  209. for i in range(len(half_concede_guests)):
  210. if i % 2 == 0:
  211. guest_rule = str(half_concede_guests[i])
  212. if guest_rule.startswith('+'):
  213. n_guest_rule = guest_rule.replace('+', '-')
  214. half_concede_guest_rule.append(n_guest_rule)
  215. if guest_rule.startswith('-'):
  216. n_guest_rule = guest_rule.replace('-', '+')
  217. half_concede_guest_rule.append(n_guest_rule)
  218. else:
  219. half_concede_guest_rule.append(guest_rule)
  220. # concede_guest
  221. if pt is 3:
  222. half_concede_guest = [float(half_concede_guests[i]) -1 for i in range(len(half_concede_guests)) if
  223. i % 2 is 1]
  224. else:
  225. half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if
  226. i % 2 is 1]
  227. except:
  228. half_concede_home_rule = ""
  229. half_concede_home = ""
  230. half_concede_guest_rule = ""
  231. half_concede_guest = ""
  232. # 全场大小size 进球大小---------------------------------------------------------------------------------------------------
  233. try:
  234. sizes = data['o']['ou']['v']
  235. new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 is 1]
  236. size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 0]
  237. # size_home_rule
  238. size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 0]
  239. # size_home
  240. if pt is 3:
  241. size_home = [float(size_homes[i]) - 1 for i in range(len(size_homes)) if i % 2 is 1]
  242. else:
  243. size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 is 1]
  244. size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 is 1]
  245. # size_guest_rule
  246. size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 0]
  247. # csize_guest
  248. if pt is 3:
  249. size_guest = [float(size_guests[i]) - 1 for i in range(len(size_guests)) if i % 2 is 1]
  250. else:
  251. size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 is 1]
  252. except:
  253. size_guest = ""
  254. size_guest_rule = ""
  255. size_home = ""
  256. size_home_rule = ""
  257. # 上半场大小 进球大小 half_size-------------------------------------------------------------------------------------------
  258. try:
  259. half_sizes = data['o']['ou1st']['v']
  260. new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 is 1]
  261. half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 0]
  262. # size_home_rule
  263. half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if
  264. i % 2 is 0]
  265. # half_size_home 主队
  266. if pt is 3:
  267. half_size_home = [float(half_size_homes[i]) -1 for i in range(len(half_size_homes)) if i % 2 is 1]
  268. else:
  269. half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 is 1]
  270. half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 is 1]
  271. # half_size_guest_rule 客队
  272. half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if
  273. i % 2 is 0]
  274. # half_size_guest
  275. if pt is 3:
  276. half_size_guest = [float(half_size_guests[i]) - 1 for i in range(len(half_size_guests)) if
  277. i % 2 is 1]
  278. else:
  279. half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if
  280. i % 2 is 1]
  281. except:
  282. half_size_guest = ""
  283. half_size_guest_rule = ""
  284. half_size_home = ""
  285. half_size_home_rule = ""
  286. # 全场总进球 total_goal--------------------------------------------------------------------------------------------------
  287. total_goal = {}
  288. try:
  289. total_goals = data['o']['tg']['v']
  290. new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 is 1]
  291. total_goal["total_goal_zero"] = float(new_total_goals[0]) - 1
  292. total_goal["total_goal_two"] = float(new_total_goals[1]) - 1
  293. total_goal["total_goal_four"] = float(new_total_goals[2]) - 1
  294. total_goal["total_goal_seven"] = float(new_total_goals[3]) - 1
  295. except:
  296. total_goal["total_goal_zero"] = ""
  297. total_goal["total_goal_two"] = ""
  298. total_goal["total_goal_four"] = ""
  299. total_goal["total_goal_seven"] = ""
  300. # 总进球上半场 half_total_goal-------------------------------------------------------------------------------------------
  301. try:
  302. half_total_goals = data['o']['tg1st']['v']
  303. new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 is 1]
  304. total_goal["half_total_goal_zero"] = float(new_half_total_goals[0]) - 1
  305. total_goal["half_total_goal_one"] = float(new_half_total_goals[1]) - 1
  306. total_goal["half_total_goal_two"] = float(new_half_total_goals[2]) - 1
  307. total_goal["half_total_goal_three"] = float(new_half_total_goals[3]) - 1
  308. except:
  309. total_goal["half_total_goal_zero"] = ""
  310. total_goal["half_total_goal_one"] = ""
  311. total_goal["half_total_goal_two"] = ""
  312. total_goal["half_total_goal_three"] = ""
  313. # 早盘 半场/全场---------------------------------------------------------------------------------------------------------
  314. half_full = {}
  315. new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest",
  316. "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest",
  317. "half_full_guest_home", "half_full_guest_dogfall", "half_full_guest_guest"]
  318. # 早盘 半场/全场
  319. try:
  320. half_fulls = data['o']['hf']['v']
  321. new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 is 1]
  322. for index, value in enumerate(new_lists):
  323. half_full[value] = float(new_half_fulls[index]) - 1
  324. except:
  325. for index, value in enumerate(new_lists):
  326. half_full[value] = ""
  327. # 早盘 最先/最后进球 最先进球 ---------------------------------------------------------------------------------------------
  328. first_last_ball = {}
  329. try:
  330. first_balls = data['o']['ttslast']['v']
  331. first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 is 1]
  332. first_last_ball['first_ball_home'] = float(first_ball[0]) - 1
  333. first_last_ball['first_ball_guest'] = float(first_ball[1]) - 1
  334. except:
  335. pass
  336. # 早盘 最先/最后进球 最后进球
  337. try:
  338. last_balls = data['o']['tts1st']['v']
  339. last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 is 1]
  340. first_last_ball['last_ball_home'] = float(last_ball[0]) - 1
  341. first_last_ball['last_ball_guest'] = float(last_ball[1]) - 1
  342. first_last_ball['not_ball'] = float(last_ball[2]) - 1
  343. except:
  344. pass
  345. # 全场独赢capot ---------------------------------------------------------------------------------------------------------
  346. try:
  347. capots = data['o']['1x2']['v']
  348. new_capots = [capots[i] for i in range(len(capots)) if i % 2 is 1]
  349. capot_home = float(new_capots[0]) - 1
  350. capot_guest = float(new_capots[1]) - 1
  351. capot_dogfall = float(new_capots[2]) - 1
  352. except:
  353. capot_home = ""
  354. capot_guest = ""
  355. capot_dogfall = ""
  356. # 上半场独赢capot
  357. try:
  358. half_capots = data['o']['1x21st']['v']
  359. new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 is 1]
  360. half_capot_home = float(new_half_capots[0]) - 1
  361. half_capot_guest = float(new_half_capots[1]) - 1
  362. half_capot_dogfall = float(new_half_capots[2]) - 1
  363. except:
  364. half_capot_home = ""
  365. half_capot_guest = ""
  366. half_capot_dogfall = ""
  367. # 全场入球:单/双 odd_even------------------------------------------------------------------------------------------------
  368. try:
  369. odd_evens = data['o']['oe']['v']
  370. new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 is 1]
  371. odd_even_odd = new_odd_evens[0]
  372. odd_even_even = new_odd_evens[1]
  373. except:
  374. odd_even_odd = ""
  375. odd_even_even = ""
  376. # 半场入球:单/双 half_odd_even
  377. try:
  378. half_odd_evens = data['o']['oe1st']['v']
  379. new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 is 1]
  380. half_odd_even_odd = new_half_odd_evens[0]
  381. half_odd_even_even = new_half_odd_evens[1]
  382. except:
  383. half_odd_even_odd = ""
  384. half_odd_even_even = ""
  385. bodan_data = {}
  386. # 波胆------------------------------------------------------------------------------------------------------------------
  387. try:
  388. bodans = data['o']['cs']['v']
  389. one_list = ["bodanhome_one_zero", "bodanhome_two_zero", "bodanhome_two_one",
  390. "bodanhome_three_zero", "bodanhome_three_one", "bodanhome_three_two",
  391. "bodanhome_four_zero", "bodanhome_four_one", "bodanhome_four_two",
  392. "bodanhome_four_three"]
  393. two_list = ["bodanguest_one_zero", "bodanguest_two_zero", "bodanguest_two_one",
  394. "bodanguest_three_zero", "bodanguest_three_one", "bodanguest_three_two",
  395. "bodanguest_four_zero", "bodanguest_four_one", "bodanguest_four_two",
  396. "bodanguest_four_three"]
  397. three_list = ["bodandogfall_zero_zero", "bodandogfall_one_one", "bodandogfall_two_two",
  398. "bodandogfall_three_three", "bodandogfall_four_four"]
  399. new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 is 1]
  400. new_bodan = new_bodans[0:20]
  401. # 主队bodan_home
  402. bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 0]
  403. for index, t in enumerate(one_list):
  404. bodan_data[t] = float(bodan_home[index]) - 1
  405. # 客队bodan_guest
  406. bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 is 1]
  407. for y, z in enumerate(two_list):
  408. bodan_data[z] = float(bodan_guest[y]) - 1
  409. bodan_dogfall = new_bodans[-7:-2]
  410. for a, b in enumerate(three_list):
  411. bodan_data[b] = float(bodan_dogfall[a]) - 1
  412. # 其他bodan_other
  413. bodan_data['bodanother'] = float(new_bodans[-1]) - 1
  414. except:
  415. pass
  416. try:
  417. half_bodans = data['o']['cs1st']['v']
  418. new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 is 1]
  419. new_one = ["halfbodanhome_one_zero", "halfbodanhome_two_zero", "halfbodanhome_two_one",
  420. "halfbodanhome_three_zero", "halfbodanhome_three_one", "halfbodanhome_three_two"]
  421. new_two = ["halfbodanguest_one_zero", "halfbodanguest_two_zero", "halfbodanguest_two_one",
  422. "halfbodanguest_three_zero", "halfbodanguest_three_one", "halfbodanguest_three_two"]
  423. new_three = ["halfbodandogfall_zero_zero", "halfbodandogfall_one_one",
  424. "halfbodandogfall_two_two",
  425. "halfbodandogfall_three_three"]
  426. halfbodan = new_half_bodans[0:12]
  427. half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 0]
  428. # 队1
  429. for index, t in enumerate(new_one):
  430. bodan_data[t] = float(half_bodan_home[index]) - 1
  431. # 队2
  432. half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 is 1]
  433. for y, z in enumerate(new_two):
  434. bodan_data[z] = float(half_bodan_guest[y]) - 1
  435. # 和/平
  436. half_bodan_dogfall = new_half_bodans[-6:-2]
  437. for a, b in enumerate(new_three):
  438. bodan_data[b] = float(half_bodan_dogfall[a]) - 1
  439. # 其他
  440. bodan_data['halfbodanother'] = float(new_half_bodans[-1]) - 1
  441. except:
  442. pass
  443. if new_data == 12:
  444. try:
  445. home_data = data['o']['ou']['v']
  446. # 球队进球 大条件
  447. home_size_big_rule = home_data[1]
  448. full_dict_rule['home_size_big'] = home_size_big_rule
  449. # 球队进球大赔率
  450. home_size_big = home_data[5]
  451. full_dict['home_size_big'] = home_size_big
  452. # 球队进球小条件
  453. home_size_small_rule = home_data[3]
  454. full_dict_rule['home_size_small'] = home_size_small_rule
  455. # 球队进球小赔率
  456. home_size_small = home_data[7]
  457. full_dict['home_size_small'] = home_size_small
  458. except:
  459. full_dict['home_size_small'] = ""
  460. full_dict_rule['home_size_small'] = ""
  461. full_dict['home_size_big'] = ""
  462. full_dict_rule['home_size_big'] = ""
  463. try:
  464. half_home_data = data['o']['ou1st']['v']
  465. half_home_size_big_rule = half_home_data[1]
  466. half_dict_rule['half_home_size_big'] = half_home_size_big_rule
  467. half_home_size_big = half_home_data[5]
  468. half_dict['half_home_size_big'] = half_home_size_big
  469. half_home_size_small_rule = half_home_data[3]
  470. half_dict_rule['half_home_size_small'] = half_home_size_small_rule
  471. half_home_size_small = half_home_data[7]
  472. half_dict['half_home_size_small'] = half_home_size_small
  473. except:
  474. half_dict_rule['half_home_size_big'] = ""
  475. half_dict['half_home_size_big'] = ""
  476. half_dict_rule['half_home_size_small'] = ""
  477. half_dict['half_home_size_small'] = ""
  478. if new_data == 13:
  479. try:
  480. guest_data = data['o']['ou']['v']
  481. guest_size_big_rule = guest_data[1]
  482. full_dict_rule['guest_size_big'] = guest_size_big_rule
  483. guest_size_big = guest_data[5]
  484. full_dict['guest_size_big'] = guest_size_big
  485. guest_size_small_rule = guest_data[3]
  486. full_dict_rule['guest_size_small'] = guest_size_small_rule
  487. guest_size_small = guest_data[7]
  488. full_dict['guest_size_small'] = guest_size_small
  489. except:
  490. full_dict_rule['guest_size_big'] = ""
  491. full_dict['guest_size_big'] = ""
  492. full_dict_rule['guest_size_small'] = ""
  493. full_dict['guest_size_small'] = ''
  494. try:
  495. half_guest_data = data['o']['ou1st']['v']
  496. half_guest_size_big_rule = half_guest_data[1]
  497. half_dict_rule['half_guest_size_big'] = half_guest_size_big_rule
  498. half_guest_size_big = half_guest_data[5]
  499. half_dict['half_guest_size_big'] = half_guest_size_big
  500. half_guest_size_small_rule = half_guest_data[3]
  501. half_dict_rule['half_guest_size_small'] = half_guest_size_small_rule
  502. half_guest_size_small = half_guest_data[7]
  503. half_dict['half_guest_size_small'] = half_guest_size_small
  504. except:
  505. half_dict_rule['half_guest_size_big'] = ""
  506. half_dict['half_guest_size_big'] = ""
  507. half_dict_rule['half_guest_size_small'] = ""
  508. half_dict['half_guest_size_small'] = ""
  509. item['league_id'] = league_id
  510. item['league_name'] = league_name
  511. item['pt'] = pt
  512. item['game_id'] = game_id
  513. item['team_home'] = team_home
  514. item['team_guest'] = team_guest
  515. item['number'] = number
  516. item['data_game'] = data_game
  517. item['time_game'] = time_game
  518. item['corner_ball'] = corner_ball
  519. # 波胆
  520. item['bodan_data'] = bodan_data
  521. # 早盘入球数单双
  522. item["odd_even_odd"] = odd_even_odd
  523. item["odd_even_even"] = odd_even_even
  524. item["half_odd_even_odd"] = half_odd_even_odd
  525. item["half_odd_even_even"] = half_odd_even_even
  526. item['total_goal'] = total_goal
  527. item["half_capot_home"] = half_capot_home
  528. item["half_capot_guest"] = half_capot_guest
  529. item["half_capot_dogfall"] = half_capot_dogfall
  530. item["capot_home"] = capot_home
  531. item["capot_guest"] = capot_guest
  532. item["capot_dogfall"] = capot_dogfall
  533. item["first_last_ball"] = first_last_ball
  534. item["half_full"] = half_full
  535. item["half_size_guest"] = half_size_guest
  536. item["half_size_guest_rule"] = half_size_guest_rule
  537. item["half_size_home"] = half_size_home
  538. item["half_size_home_rule"] = half_size_home_rule
  539. # 全场大小
  540. item["size_guest"] = size_guest
  541. item["size_guest_rule"] = size_guest_rule
  542. item["size_home"] = size_home
  543. item["size_home_rule"] = size_home_rule
  544. # 上半场让球
  545. item["half_concede_home_rule"] = half_concede_home_rule
  546. item["half_concede_home"] = half_concede_home
  547. item["half_concede_guest_rule"] = half_concede_guest_rule
  548. item["half_concede_guest"] = half_concede_guest
  549. # 全场让球
  550. item["concede_guest"] = concede_guest
  551. item["concede_guest_rule"] = concede_guest_rule
  552. item["concede_home"] = concede_home
  553. item["concede_home_rule"] = concede_home_rule
  554. item['score_home'] = score_home
  555. item['score_guest'] = score_guest
  556. item['full_data'] = full_dict
  557. item['half_data'] = half_dict
  558. item['full_data_rule'] = full_dict_rule
  559. item['half_data_rule'] = half_dict_rule
  560. item['half_way'] = half_way
  561. yield item