roll_bangqiu.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import datetime
  4. import jsonpath
  5. __author__ = 'ethereal'
  6. __mtime__ = '2019/4/16'
  7. # -*- coding: utf-8 -*-
  8. import json
  9. import scrapy
  10. from scrapy.http import Request
  11. from ..items import Roll_Bangqiu
  12. class BqrangqiuSpider(scrapy.Spider):
  13. name = 'roll_bangqiu'
  14. to_day = datetime.datetime.now()
  15. allowed_domains = ['hg3535z.com']
  16. custom_settings = {
  17. "ITEM_PIPELINES": {
  18. "hg3535.pipelines.Roll_Banqiupipeline": 300,
  19. },
  20. 'LOG_LEVEL': 'DEBUG',
  21. 'LOG_FILE': "../hg3535/log/roll_bangqiu_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day)
  22. }
  23. start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=4&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 棒球滚球列url
  24. # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球测试滚球列url
  25. # start_urls = ['https://www.baidu.com']
  26. def parse(self, response):
  27. datas = json.loads(response.text)
  28. # urls = "https://www.baidu.com"
  29. # yield Request(url=urls,callback=self.parse_each)
  30. # datas ={"i": ["true", 4, 3110520, 2, 1, "sh", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "14 / 04", "", "", "false", "true", "\u68d2\u7403", 0], "eg": {"c": {"k": 29400, "n": "\u7f8e\u56fd\u804c\u4e1a\u68d2\u7403"}, "es": [{"dbg": "false", "egid": 0, "g": "", "i": ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f", "\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f", "9", "True", "14 / 04", "", "9", "False", "0", "0", "2", "1", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110520, "o": {"ah": {"s": 1, "v": ["h3164784133", "-1.5", "h3164784134", "+1.5", "o3164784133", "1.33", "o3164784134", "0.55"], "n": "\u6eda\u7403 \u8ba9\u7403"}, "ou": {"s": 2, "v": ["h3164784135", "6.5", "h3164784136", "6.5", "o3164784135", "0.70", "o3164784136", "1.04"], "n": "\u603b\u5f97\u5206:\u6eda\u7403 \u5927 / \u5c0f"}, "oe": {"s": 6, "v": ["o3164784137", "0.51", "o3164784138", "1.58"], "n": "\u603b\u5f97\u5206:\u6eda\u7403 \u5355 / \u53cc"}, "ml": {"s": 5, "v": ["o3164784139", "0.00", "o3164784140", "0.00"], "n": "\u6eda\u7403 \u72ec\u8d62\u76d8"}}, "p-o": [{"n": "\u51c0\u80dc\u7403\u6570", "st": "ha", "mgk": 9, "s": 7, "k": 301, "o": [["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f971\u5206", "o3164784186", "3.15", "0"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f972\u5206", "o3164784187", "5.5", "3"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f973\u5206", "o3164784188", "9.5", "6"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f974\u5206\u6216\u66f4\u591a", "o3164784189", "7.5", "9"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f971\u5206", "o3164784190", "5.0", "2"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f972\u5206", "o3164784191", "7.5", "5"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f973\u5206", "o3164784192", "11.5", "8"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f974\u5206\u6216\u66f4\u591a", "o3164784193", "10.0", "11"]]}, {"n": "\u7b2c6\u5c40\u83b7\u80dc\u8005", "st": "ha", "mgk": 0, "s": 3000, "k": 4000, "o": [["\u548c\u5c40", "o3164784213", "1.50"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f", "o3164784214", "5.5"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f", "o3164784215", "3.80"]]}, {"n": "\u52a0\u65f6", "st": "ha", "mgk": 312, "s": 8, "k": 13520, "o": [["\u662f", "o3164784228", "6.0"], ["\u4e0d\u662f", "o3164784229", "1.09"]]}], "pci": {"ctid": 0}, "sb": {"fb": "false", "sb": "false", "tb": "false", "ot": 0, "ps": [{"adv": -1, "a": 1.0, "e": 3110520, "h": 2.0, "p": "ft"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "ot"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i1"}, {"adv": -1, "a": 1.0, "e": 3110520, "h": 1.0, "p": "i2"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 1.0, "p": "i3"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i4"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i5"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i6"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i7"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i8"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i9"}], "a": 1, "h": 2, "k": 3110520, "iwd": "false", "ls": -1, "s": 1, "ts": 0, "tt": 0, "ct": "00:00", "cp": "i5"}, "egn": ""}, {"dbg": "false", "egid": 0, "g": "", "i": ["ATL Braves - Team Runs - Over", "ATL Braves - Team Runs - Under", "9", "True", "14 / 04", "", "9", "False", "0", "0", "2", "0", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110522, "o": {"ou": {"s": 3, "v": ["h3164784242", "3.5", "h3164784243", "3.5", "o3164784242", "1.12", "o3164784243", "0.63"], "n": "\u7403\u961f\u5f97\u5206:\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u6eda\u7403 \u5927 / \u5c0f"}}, "pci": {"ctid": 208, "ctn": "\u7403\u961f\u5f97\u5206"}, "egn": ""}, {"dbg": "false", "egid": 0, "g": "", "i": ["NY Mets - Team Runs - Over", "NY Mets - Team Runs - Under", "9", "True", "14 / 04", "", "9", "False", "0", "0", "1", "0", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110524, "o": {"ou": {"s": 4, "v": ["h3164784261", "2.5", "h3164784263", "2.5", "o3164784261", "0.55", "o3164784263", "1.23"], "n": "\u7403\u961f\u5f97\u5206:\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u6eda\u7403 \u5927 / \u5c0f"}}, "pci": {"ctid": 209, "ctn": "\u7403\u961f\u5f97\u5206"}, "egn": ""}]}, "ot": 2, "sc": {"3110520": {"a": 1, "h": 2}, "3110522": {"a": 0, "h": 2}, "3110524": {"a": 0, "h": 1}}, "v": 40576}
  31. # item = Today_all()
  32. ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
  33. print(ids)
  34. if ids:
  35. ids = set(ids)
  36. for i in ids:
  37. urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
  38. print(urls)
  39. yield Request(url=urls, callback=self.parse_each, dont_filter=True)
  40. def parse_each(self, response):
  41. datas = json.loads(response.text)
  42. # datas = {"i":['true',4,3181711,4,4,"sh",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"13 / 05","","",'false','true',"棒球",0],"eg":{"c":{"k":29400,"n":"美国职业棒球"},"es":[{"dbg":'false',"egid":0,"g":"","i":["费城费城人队","米尔沃基酿酒人队","8","True","13 / 05","","8","False","0","0","4","4","","","","",0,"","",16,"True"],"ibs":'true',"ibsc":'false',"k":3181711,"o":{"ah":{"s":1,"v":["h3284690015","-1.5","h3284690016","+1.5","o3284690015","0.00","o3284690016","0.00"],"n":"滚球 让球"},"ou":{"s":2,"v":["h3284690017","10","h3284690018","10","o3284690017","0.00","o3284690018","0.00"],"n":"总得分:滚球 大 / 小"},"oe":{"s":6,"v":["o3284690025","0.36","o3284690026","2.08"],"n":"总得分:滚球 单 / 双"}},"p-o":[{"n":"净胜球数","st":"ha","mgk":9,"s":7,"k":301,"o":[["费城费城人队-赢得1分","o3284690078","2.54","0"],["费城费城人队-赢得2分","o3284690079","5.5","3"],["费城费城人队-赢得3分","o3284690080","10.5","6"],["费城费城人队-赢得4分或更多","o3284690081","13.0","9"],["米尔沃基酿酒人队-赢得1分","o3284690082","3.65","2"],["米尔沃基酿酒人队-赢得2分","o3284690083","9.0","5"],["米尔沃基酿酒人队-赢得3分","o3284690084","16.5","8"],["米尔沃基酿酒人队-赢得4分或更多","o3284690085","16.5","11"]]},{"n":"第8局获胜者","st":"ha","mgk":0,"s":3000,"k":4002,"o":[["和局","o3284690144","1.54"],["费城费城人队","o3284690145","4.90"],["米尔沃基酿酒人队","o3284690146","3.90"]]},{"n":"加时","st":"ha","mgk":312,"s":8,"k":13520,"o":[["是","o3284690152","2.86"],["不是","o3284690153","1.37"]]}],"pci":{"ctid":0},"sb":{"fb":'true',"sb":'false',"tb":'false',"ot":1,"ps":[{"adv":-1,"a":4,"e":3181711,"h":4,"p":"ft"},{"adv":-1,"a":0,"e":3181711,"h":0,"p":"ot"},{"adv":-1,"a":2,"e":3181711,"h":0,"p":"i1"},{"adv":-1,"a":0,"e":3181711,"h":2,"p":"i2"},{"adv":-1,"a":1,"e":3181711,"h":0,"p":"i3"},{"adv":-1,"a":1,"e":3181711,"h":0,"p":"i4"},{"adv":-1,"a":0,"e":3181711,"h":2,"p":"i5"},{"adv":-1,"a":0,"e":3181711,"h":0,"p":"i6"},{"adv":-1,"a":0,"e":3181711,"h":0,"p":"i7"},{"adv":-1,"a":0,"e":3181711,"h":0,"p":"i8"},{"adv":-1,"a":0,"e":3181711,"h":0,"p":"i9"}],"a":4,"h":4,"k":3181711,"iwd":'false',"ls":-1,"s":1,"ts":0,"tt":0,"ct":"00:00","cp":"i7"},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["PHI Phillies - Team Runs - Over","PHI Phillies - Team Runs - Under","8","True","13 / 05","","8","False","0","0","4","0","","","","",0,"","",16,"True"],"ibs":'true',"ibsc":'false',"k":3181713,"o":{"ou":{"s":3,"v":["h3284690171","5.5","h3284690173","5.5","o3284690171","1.33","o3284690173","0.49"],"n":"球队得分:费城费城人队-滚球 大 / 小"}},"pci":{"ctid":208,"ctn":"球队得分"},"egn":""},{"dbg":'false',"egid":0,"g":"","i":["MIL Brewers - Team Runs - Over","MIL Brewers - Team Runs - Under","8","True","13 / 05","","8","False","0","0","4","0","","","","",0,"","",16,"True"],"ibs":'true',"ibsc":'false',"k":3181715,"o":{"ou":{"s":4,"v":["h3284690196","4.5","h3284690198","4.5","o3284690196","0.70","o3284690198","1.04"],"n":"球队得分:米尔沃基酿酒人队-滚球 大 / 小"}},"pci":{"ctid":209,"ctn":"球队得分"},"egn":""}]},"ot":2,"sc":{"3181711":{"a":4,"h":4},"3181713":{"a":0,"h":4},"3181715":{"a":0,"h":4}},"v":28249}
  43. # datas ={"i": ["true", 4, 3110520, 2, 1, "sh", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "14 / 04", "", "", "false", "true", "\u68d2\u7403", 0], "eg": {"c": {"k": 29400, "n": "\u7f8e\u56fd\u804c\u4e1a\u68d2\u7403"}, "es": [{"dbg": "false", "egid": 0, "g": "", "i": ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f", "\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f", "9", "True", "14 / 04", "", "9", "False", "0", "0", "2", "1", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110520, "o": {"ah": {"s": 1, "v": ["h3164784133", "-1.5", "h3164784134", "+1.5", "o3164784133", "1.33", "o3164784134", "0.55"], "n": "\u6eda\u7403 \u8ba9\u7403"}, "ou": {"s": 2, "v": ["h3164784135", "6.5", "h3164784136", "6.5", "o3164784135", "0.70", "o3164784136", "1.04"], "n": "\u603b\u5f97\u5206:\u6eda\u7403 \u5927 / \u5c0f"}, "oe": {"s": 6, "v": ["o3164784137", "0.51", "o3164784138", "1.58"], "n": "\u603b\u5f97\u5206:\u6eda\u7403 \u5355 / \u53cc"}, "ml": {"s": 5, "v": ["o3164784139", "0.00", "o3164784140", "0.00"], "n": "\u6eda\u7403 \u72ec\u8d62\u76d8"}}, "p-o": [{"n": "\u51c0\u80dc\u7403\u6570", "st": "ha", "mgk": 9, "s": 7, "k": 301, "o": [["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f971\u5206", "o3164784186", "3.15", "0"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f972\u5206", "o3164784187", "5.5", "3"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f973\u5206", "o3164784188", "9.5", "6"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u8d62\u5f974\u5206\u6216\u66f4\u591a", "o3164784189", "7.5", "9"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f971\u5206", "o3164784190", "5.0", "2"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f972\u5206", "o3164784191", "7.5", "5"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f973\u5206", "o3164784192", "11.5", "8"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u8d62\u5f974\u5206\u6216\u66f4\u591a", "o3164784193", "10.0", "11"]]}, {"n": "\u7b2c6\u5c40\u83b7\u80dc\u8005", "st": "ha", "mgk": 0, "s": 3000, "k": 4000, "o": [["\u548c\u5c40", "o3164784213", "1.50"], ["\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f", "o3164784214", "5.5"], ["\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f", "o3164784215", "3.80"]]}, {"n": "\u52a0\u65f6", "st": "ha", "mgk": 312, "s": 8, "k": 13520, "o": [["\u662f", "o3164784228", "6.0"], ["\u4e0d\u662f", "o3164784229", "1.09"]]}], "pci": {"ctid": 0}, "sb": {"fb": "false", "sb": "false", "tb": "false", "ot": 0, "ps": [{"adv": -1, "a": 1.0, "e": 3110520, "h": 2.0, "p": "ft"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "ot"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i1"}, {"adv": -1, "a": 1.0, "e": 3110520, "h": 1.0, "p": "i2"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 1.0, "p": "i3"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i4"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i5"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i6"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i7"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i8"}, {"adv": -1, "a": 0.0, "e": 3110520, "h": 0.0, "p": "i9"}], "a": 1, "h": 2, "k": 3110520, "iwd": "false", "ls": -1, "s": 1, "ts": 0, "tt": 0, "ct": "00:00", "cp": "i5"}, "egn": ""}, {"dbg": "false", "egid": 0, "g": "", "i": ["ATL Braves - Team Runs - Over", "ATL Braves - Team Runs - Under", "9", "True", "14 / 04", "", "9", "False", "0", "0", "2", "0", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110522, "o": {"ou": {"s": 3, "v": ["h3164784242", "3.5", "h3164784243", "3.5", "o3164784242", "1.12", "o3164784243", "0.63"], "n": "\u7403\u961f\u5f97\u5206:\u4e9a\u7279\u5170\u5927\u52c7\u58eb\u961f-\u6eda\u7403 \u5927 / \u5c0f"}}, "pci": {"ctid": 208, "ctn": "\u7403\u961f\u5f97\u5206"}, "egn": ""}, {"dbg": "false", "egid": 0, "g": "", "i": ["NY Mets - Team Runs - Over", "NY Mets - Team Runs - Under", "9", "True", "14 / 04", "", "9", "False", "0", "0", "1", "0", "", "", "", "", 0, "", "", 16, "True"], "ibs": "true", "ibsc": "false", "k": 3110524, "o": {"ou": {"s": 4, "v": ["h3164784261", "2.5", "h3164784263", "2.5", "o3164784261", "0.55", "o3164784263", "1.23"], "n": "\u7403\u961f\u5f97\u5206:\u7ebd\u7ea6\u5927\u90fd\u4f1a\u961f-\u6eda\u7403 \u5927 / \u5c0f"}}, "pci": {"ctid": 209, "ctn": "\u7403\u961f\u5f97\u5206"}, "egn": ""}]}, "ot": 2, "sc": {"3110520": {"a": 1, "h": 2}, "3110522": {"a": 0, "h": 2}, "3110524": {"a": 0, "h": 1}}, "v": 40576}
  44. try:
  45. # new_datas = json.loads(response.text)['eg']
  46. new_datas = datas['eg']
  47. except:
  48. new_datas = ""
  49. try:
  50. pt = response.meta['pt']
  51. except:
  52. pt = 0
  53. if new_datas:
  54. # 联赛id
  55. league_id = new_datas["c"]["k"]
  56. # 联赛名
  57. league_name = new_datas["c"]["n"]
  58. new_data = new_datas["es"]
  59. for result in new_data:
  60. if result['pci']["ctid"] == 0:
  61. item = Roll_Bangqiu()
  62. # 比赛id
  63. game_id = str(result['k'])
  64. # 球队1
  65. team_home = result['i'][0]
  66. # 球队2
  67. team_guest = result['i'][1]
  68. # 数量(97>)
  69. number = result['i'][2]
  70. # 比赛状态
  71. zhuangtai = result['i'][3]
  72. # 日期
  73. data_game = result['i'][4]
  74. # 开赛时间
  75. time_game = result['i'][5]
  76. # 队1分数
  77. score_home1 = result['i'][10]
  78. # 队2分数
  79. score_guest1 = result['i'][11]
  80. # 第几盘
  81. jijie = result['i'][12]
  82. # 球队得分
  83. qiudui = result['pci'].get('ctn', "")
  84. # 是否出局 不一定存在
  85. ot = result['sb'].get("ot","")
  86. ps_list = result['sb']['ps']
  87. #返回筛选值后的列表嵌套元组的结构
  88. # def total(l):
  89. # a, h, p = zip(*map(lambda x: (x['a'],x['h'],x['p']),l))
  90. # a,h,p = list(a),list(h),list(p)
  91. # res = list(zip(a,h,p))
  92. # return res
  93. # res = total(ps_list)
  94. # d = {}
  95. # d['ps_list'] = res
  96. # d['ot'] = ot
  97. d = {}
  98. d['ps'] = ps_list
  99. d['ot'] = ot
  100. pass
  101. # --------------------------------------------------让球分割线-----------------------------------------------------------
  102. concedes_dict = {}
  103. concedes_dict_rule = {}
  104. try:
  105. concedes = result['o']["ah"]["v"]
  106. concedes_dict_rule['concede_home'] = concedes[1]
  107. concedes_dict['concede_home'] = concedes[5]
  108. concedes_dict_rule['concede_guest'] = concedes[3]
  109. concedes_dict['concede_guest'] = concedes[7]
  110. except:
  111. concedes_dict_rule['concede_home'] = ""
  112. concedes_dict['concede_home'] = ""
  113. concedes_dict_rule['concede_guest'] = ""
  114. concedes_dict['concede_guest'] = ""
  115. # 让球 前5局-------------------------------------------------------------------------------------------------------------
  116. try:
  117. concedes = result['o']["ahf5in"]["v"]
  118. concedes_dict_rule['five_concede_home'] = concedes[1]
  119. concedes_dict['five_concede_home'] = concedes[5]
  120. concedes_dict_rule['five_concede_guest'] = concedes[3]
  121. concedes_dict['five_concede_guest'] = concedes[7]
  122. except:
  123. concedes_dict_rule['five_concede_home'] = ""
  124. concedes_dict['five_concede_home'] = ""
  125. concedes_dict_rule['five_concede_guest'] = ""
  126. concedes_dict['five_concede_guest'] = ""
  127. # ---------------------------------------------------独赢----------------------------------------------------------------
  128. capots_dict = {}
  129. try:
  130. capots = result['o']["ml"]["v"]
  131. capots_dict['capot_home'] = capots[1]
  132. capots_dict['capot_guest'] = capots[3]
  133. except:
  134. capots_dict['capot_home'] = ""
  135. capots_dict['capot_guest'] = ""
  136. # ---------------------------------------------------总得分:大/小--------------------------------------------------------
  137. total_size_dict = {}
  138. total_size_dict_rule = {}
  139. try:
  140. total_sizes = result['o']["ou"]["v"]
  141. total_size_dict_rule['total_number_big'] = total_sizes[1]
  142. total_size_dict['total_number_big'] = total_sizes[5]
  143. total_size_dict_rule['total_number_small'] = total_sizes[3]
  144. total_size_dict['total_number_small'] = total_sizes[7]
  145. except:
  146. total_size_dict_rule['total_number_big'] = ""
  147. total_size_dict['total_number_big'] = ""
  148. total_size_dict_rule['total_number_small'] = ""
  149. total_size_dict['total_number_small'] = ""
  150. # 总得分: 大/小 前5局-----------------------------------------------------------------------------------------------------
  151. try:
  152. total_sizes = result['o']["ouf5in"]["v"]
  153. total_size_dict_rule['five_total_number_big'] = total_sizes[1]
  154. total_size_dict['five_total_number_big'] = total_sizes[5]
  155. total_size_dict_rule['five_total_number_small'] = total_sizes[3]
  156. total_size_dict['five_total_number_small'] = total_sizes[7]
  157. except:
  158. total_size_dict_rule['five_total_number_big'] = ""
  159. total_size_dict['five_total_number_big'] = ""
  160. total_size_dict_rule['five_total_number_small'] = ""
  161. total_size_dict['five_total_number_small'] = ""
  162. # ------------------------------------------------------总得分:单/双-----------------------------------------------------
  163. odd_evens_dict = {}
  164. odd_evens_dict_rule = {}
  165. try:
  166. odd_evens = result['o']["oe"]["v"]
  167. # 上半场 主队让球条件
  168. odd_evens_dict['two_sides_single'] = odd_evens[1]
  169. odd_evens_dict_rule['two_sides_single'] = "单"
  170. odd_evens_dict['two_sides_double'] = odd_evens[3]
  171. odd_evens_dict_rule['two_sides_double'] = "双"
  172. except:
  173. odd_evens_dict['two_sides_single'] = ""
  174. odd_evens_dict['two_sides_double'] = ""
  175. odd_evens_dict_rule['two_sides_single'] = ""
  176. odd_evens_dict_rule['two_sides_double'] = ""
  177. # 联赛id
  178. item['league_id'] = league_id
  179. # 联赛名
  180. item['league_name'] = league_name
  181. # 比赛id
  182. item['game_id'] = game_id
  183. # 球队1
  184. item['team_home'] = team_home
  185. # 球队2
  186. item['team_guest'] = team_guest
  187. # 数量(97>)
  188. item['number'] = number
  189. # 比赛状态
  190. item['zhuangtai'] = zhuangtai
  191. # 日期
  192. item['data_game'] = data_game
  193. # 开赛时间
  194. item['time_game'] = time_game
  195. # 队1分数
  196. item['score_home'] = score_home1
  197. # 队2分数
  198. item['score_guest'] = score_guest1
  199. # 第几节
  200. item['jijie'] = jijie
  201. item['pt'] = pt
  202. # 球队得分
  203. item['qiudui'] = qiudui
  204. # 让球
  205. item['concedes_dict'] = concedes_dict
  206. item['concedes_dict_rule'] = concedes_dict_rule
  207. # 独赢
  208. item['capots_dict'] = capots_dict
  209. # 总得分:大/小
  210. item['total_size_dict'] = total_size_dict
  211. item['total_size_dict_rule'] = total_size_dict_rule
  212. # 总得分:单/双
  213. item['odd_evens_dict'] = odd_evens_dict
  214. item['odd_evens_dict_rule'] = odd_evens_dict_rule
  215. item['match_score_dict'] = d
  216. yield item