|
@@ -1,833 +0,0 @@
|
|
|
-# -*- coding: utf-8 -*-
|
|
|
|
|
-# import jmespath
|
|
|
|
|
-import jsonpath
|
|
|
|
|
-import scrapy
|
|
|
|
|
-import json
|
|
|
|
|
-# from scrapy.http import Request
|
|
|
|
|
-
|
|
|
|
|
-from scrapy_yzd.items import Today_all
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-def reverli(li=[]):
|
|
|
|
|
- if not li:
|
|
|
|
|
- li = []
|
|
|
|
|
- for i in li:
|
|
|
|
|
- if isinstance(i,int):
|
|
|
|
|
- res1 = "".join('%s' %i)
|
|
|
|
|
- return res1
|
|
|
|
|
- res = "".join(li)
|
|
|
|
|
- return res
|
|
|
|
|
-
|
|
|
|
|
-odd_nums = [ i for i in range(1,101) if i %2 ==1]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-def dict_get(dict1, objkey, default):
|
|
|
|
|
- tmp = dict1
|
|
|
|
|
- for k, v in tmp.items():
|
|
|
|
|
- # print(k,v)
|
|
|
|
|
- if k == objkey:
|
|
|
|
|
- return v
|
|
|
|
|
- elif isinstance(v, dict):
|
|
|
|
|
- ret = dict_get(v, objkey, default)
|
|
|
|
|
- if ret is not default:
|
|
|
|
|
- return ret
|
|
|
|
|
- else:
|
|
|
|
|
- if isinstance(v, list):
|
|
|
|
|
- for i in v:
|
|
|
|
|
- ret = dict_get(i, objkey, default)
|
|
|
|
|
- if ret is not default:
|
|
|
|
|
- return ret
|
|
|
|
|
- return default
|
|
|
|
|
-
|
|
|
|
|
-class Hg3535Spider(scrapy.Spider):
|
|
|
|
|
- name = 'hg3535'
|
|
|
|
|
- allowed_domains = ['hg3535z.com']
|
|
|
|
|
- start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
|
|
|
|
|
- # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球url
|
|
|
|
|
- # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
|
|
|
|
|
- # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] #篮球
|
|
|
|
|
- # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=1&ubt=am&pn=0&sb=2&dc=null&pid=0']
|
|
|
|
|
- custom_settings = {
|
|
|
|
|
- "ITEM_PIPELINES": {
|
|
|
|
|
- "scrapy_yzd.pipelines.ScrapyYzdPipeline": 100,
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- def parse(self, response):
|
|
|
|
|
- datas = json.loads(response.text)
|
|
|
|
|
- item = Today_all()
|
|
|
|
|
- ids = []
|
|
|
|
|
- #页面没数据异常处理
|
|
|
|
|
- try:
|
|
|
|
|
- results = datas['i-ot'][0]['egs']
|
|
|
|
|
- except KeyError:
|
|
|
|
|
- results = []
|
|
|
|
|
- #4个字典
|
|
|
|
|
- concedelist = {}
|
|
|
|
|
- oddevenlist = {}
|
|
|
|
|
- capotlist = {}
|
|
|
|
|
- totalgoallist = {}
|
|
|
|
|
- halffulllist = {}
|
|
|
|
|
- bodanlist = {}
|
|
|
|
|
- firstlastballlist = {}
|
|
|
|
|
- #第一
|
|
|
|
|
- for result in results:
|
|
|
|
|
- league_id = result['c']['k'] #联赛id
|
|
|
|
|
- league_name = result['c']['n'] #联赛名
|
|
|
|
|
- new_results = result['es'] # 取出列表嵌套字典
|
|
|
|
|
- #二
|
|
|
|
|
- for new_result in new_results:
|
|
|
|
|
- # ids = []
|
|
|
|
|
- game_id = str(new_result['i'][16]) #比赛id
|
|
|
|
|
- # ids.append(game_id)
|
|
|
|
|
- # if ids:
|
|
|
|
|
- # ids1 = set(ids)#去重
|
|
|
|
|
- # for i in ids1:
|
|
|
|
|
- # urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
|
|
|
|
|
- # print(urls)
|
|
|
|
|
- # yield Request(url=urls, callback=self.parse_other)
|
|
|
|
|
- # if ids:
|
|
|
|
|
- # ids1 = set(ids)#去重
|
|
|
|
|
- # for i in ids1:
|
|
|
|
|
- # urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
|
|
|
|
|
- # print(urls)
|
|
|
|
|
- # yield Request(url=urls, callback=self.parse_each)
|
|
|
|
|
- team_home = new_result['i'][0] # 球队一
|
|
|
|
|
- team_guest = new_result['i'][1] # 球队二
|
|
|
|
|
- number = new_result['i'][2] # 数量
|
|
|
|
|
- data_game = new_result['i'][4] # 日期
|
|
|
|
|
- time_game = new_result['i'][5] # 开赛时间
|
|
|
|
|
- score_home = new_result['i'][10] # 队一分数
|
|
|
|
|
- score_guest = new_result['i'][11] # 队二分数
|
|
|
|
|
- half_way = new_result['i'][12] #下半场
|
|
|
|
|
- corner_ball = new_result['pci'].get('ctn',"") #角球
|
|
|
|
|
- status = new_result['i'][3] # 状态值
|
|
|
|
|
-
|
|
|
|
|
- # 全场让球 concede
|
|
|
|
|
- concede_size = {}
|
|
|
|
|
- concedes = new_result['o'].get('ah', "")
|
|
|
|
|
- if concedes:
|
|
|
|
|
- new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 == 1]
|
|
|
|
|
- concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 0]
|
|
|
|
|
- # concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 0]
|
|
|
|
|
- concede_home_rule = [] #测试
|
|
|
|
|
- for i in range(len(concede_homes)):
|
|
|
|
|
- if i % 2 == 0:
|
|
|
|
|
- home_rule = str(concede_homes[i])
|
|
|
|
|
- if home_rule.startswith('+'):
|
|
|
|
|
- n_home_rule = home_rule.replace('+', '-')
|
|
|
|
|
- concede_home_rule.append(n_home_rule)
|
|
|
|
|
- if home_rule.startswith('-'):
|
|
|
|
|
- n_home_rule = home_rule.replace('-', '+')
|
|
|
|
|
- concede_home_rule.append(n_home_rule)
|
|
|
|
|
- else:
|
|
|
|
|
- concede_home_rule.append(home_rule)
|
|
|
|
|
-
|
|
|
|
|
- # concede_home_rule
|
|
|
|
|
- concede_size["concede_home_rule"] = concede_home_rule
|
|
|
|
|
- # concede_home
|
|
|
|
|
- concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 1]
|
|
|
|
|
- concede_size["concede_home"] = concede_home
|
|
|
|
|
- concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 1]
|
|
|
|
|
- # concede_guest_rule
|
|
|
|
|
- # concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 0]
|
|
|
|
|
- concede_guest_rule = [] #测试
|
|
|
|
|
- for i in range(len(concede_guests)):
|
|
|
|
|
- if i % 2 == 0:
|
|
|
|
|
- guest_rule = str(concede_guests[i])
|
|
|
|
|
- if guest_rule.startswith('+'):
|
|
|
|
|
- n_guest_rule = guest_rule.replace('+', '-')
|
|
|
|
|
- concede_guest_rule.append(n_guest_rule)
|
|
|
|
|
- if guest_rule.startswith('-'):
|
|
|
|
|
- n_guest_rule = guest_rule.replace('-', '+')
|
|
|
|
|
- concede_guest_rule.append(n_guest_rule)
|
|
|
|
|
- else:
|
|
|
|
|
- concede_guest_rule.append(guest_rule)
|
|
|
|
|
- concede_size["concede_guest_rule"] = concede_guest_rule
|
|
|
|
|
- # concede_guest
|
|
|
|
|
- concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 1]
|
|
|
|
|
- concede_size["concede_guest"] = concede_guest
|
|
|
|
|
- else:
|
|
|
|
|
- concede_size["concede_guest"] = ""
|
|
|
|
|
- concede_size["concede_guest_rule"] = ""
|
|
|
|
|
- concede_size["concede_home"] = ""
|
|
|
|
|
- concede_size["concede_home_rule"] = ""
|
|
|
|
|
-
|
|
|
|
|
- # 上半场让球half_concede 滚球不存在
|
|
|
|
|
- half_concedes = new_result['o'].get('ah1st', "")
|
|
|
|
|
- if half_concedes:
|
|
|
|
|
- new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 == 1]
|
|
|
|
|
- new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 0]
|
|
|
|
|
- # half_concede_home_rule
|
|
|
|
|
- # half_concede_home_rule = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 0]
|
|
|
|
|
- half_concede_home_rule = []
|
|
|
|
|
- # concede_home_rule = []
|
|
|
|
|
- for i in range(len(new_half_concede_homes)):
|
|
|
|
|
- if i % 2 == 0:
|
|
|
|
|
- home_rule = str(new_half_concede_homes[i])
|
|
|
|
|
- if home_rule.startswith('+'):
|
|
|
|
|
- n_home_rule = home_rule.replace('+', '-')
|
|
|
|
|
- half_concede_home_rule.append(n_home_rule)
|
|
|
|
|
- if home_rule.startswith('-'):
|
|
|
|
|
- n_home_rule = home_rule.replace('-', '+')
|
|
|
|
|
- half_concede_home_rule.append(n_home_rule)
|
|
|
|
|
- else:
|
|
|
|
|
- half_concede_home_rule.append(home_rule)
|
|
|
|
|
- concede_size["half_concede_home_rule"] = half_concede_home_rule
|
|
|
|
|
- # concede_home
|
|
|
|
|
- half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 1]
|
|
|
|
|
- concede_size["half_concede_home"] = half_concede_home
|
|
|
|
|
- half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 1]
|
|
|
|
|
- # concede_guest_rule
|
|
|
|
|
- # half_concede_guest_rule = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 0]
|
|
|
|
|
- half_concede_guest_rule = [] #测试
|
|
|
|
|
- for i in range(len(half_concede_guests)):
|
|
|
|
|
- if i % 2 == 0:
|
|
|
|
|
- guest_rule = str(half_concede_guests[i])
|
|
|
|
|
- if guest_rule.startswith('+'):
|
|
|
|
|
- n_guest_rule = guest_rule.replace('+', '-')
|
|
|
|
|
- half_concede_guest_rule.append(n_guest_rule)
|
|
|
|
|
- if guest_rule.startswith('-'):
|
|
|
|
|
- n_guest_rule = guest_rule.replace('-', '+')
|
|
|
|
|
- half_concede_guest_rule.append(n_guest_rule)
|
|
|
|
|
- else:
|
|
|
|
|
- half_concede_guest_rule.append(guest_rule)
|
|
|
|
|
- concede_size["half_concede_guest_rule"] = half_concede_guest_rule
|
|
|
|
|
- # concede_guest
|
|
|
|
|
- half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 1]
|
|
|
|
|
- concede_size["half_concede_guest"] = half_concede_guest
|
|
|
|
|
- else:
|
|
|
|
|
- concede_size["half_concede_home_rule"] = ""
|
|
|
|
|
- concede_size["half_concede_home"] = ""
|
|
|
|
|
- concede_size["half_concede_guest_rule"] = ""
|
|
|
|
|
- concede_size["half_concede_guest"] = ""
|
|
|
|
|
-
|
|
|
|
|
- # 全场大小size
|
|
|
|
|
- sizes = new_result['o'].get('ou', "")
|
|
|
|
|
- if sizes:
|
|
|
|
|
- new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 == 1]
|
|
|
|
|
- size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 0]
|
|
|
|
|
- # size_home_rule
|
|
|
|
|
- size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 0]
|
|
|
|
|
- concede_size["size_home_rule"] = size_home_rule
|
|
|
|
|
- # size_home
|
|
|
|
|
- size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 1]
|
|
|
|
|
- concede_size["size_home"] = size_home
|
|
|
|
|
- size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 1]
|
|
|
|
|
- # size_guest_rule
|
|
|
|
|
- size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 0]
|
|
|
|
|
- concede_size["size_guest_rule"] = size_guest_rule
|
|
|
|
|
- # csize_guest
|
|
|
|
|
- size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 1]
|
|
|
|
|
- concede_size["size_guest"] = size_guest
|
|
|
|
|
- else:
|
|
|
|
|
- concede_size["size_guest"] = ""
|
|
|
|
|
- concede_size["size_guest_rule"] = ""
|
|
|
|
|
- concede_size["size_home"] = ""
|
|
|
|
|
- concede_size["size_home_rule"] = ""
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 上半场大小 half_size
|
|
|
|
|
- half_sizes = new_result['o'].get('ou1st',"")
|
|
|
|
|
- if half_sizes:
|
|
|
|
|
- new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 == 1]
|
|
|
|
|
- half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 0]
|
|
|
|
|
- # size_home_rule
|
|
|
|
|
- half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 0]
|
|
|
|
|
- concede_size["half_size_home_rule"] = half_size_home_rule
|
|
|
|
|
- # half_size_home
|
|
|
|
|
- half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 1]
|
|
|
|
|
- concede_size["half_size_home"] =half_size_home
|
|
|
|
|
- half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 1]
|
|
|
|
|
- # half_size_guest_rule
|
|
|
|
|
- half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 0]
|
|
|
|
|
- concede_size["half_size_guest_rule"] = half_size_guest_rule
|
|
|
|
|
- # half_size_guest
|
|
|
|
|
- half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 1]
|
|
|
|
|
- concede_size["half_size_guest"] = half_size_guest
|
|
|
|
|
- else:
|
|
|
|
|
- concede_size["half_size_guest"] = ""
|
|
|
|
|
- concede_size["half_size_guest_rule"] = ""
|
|
|
|
|
- concede_size["half_size_home"] = ""
|
|
|
|
|
- concede_size["half_size_home_rule"] = ""
|
|
|
|
|
- concede_size['league_id'] = league_id
|
|
|
|
|
- concede_size['league_name'] = league_name
|
|
|
|
|
- concede_size['game_id'] = game_id
|
|
|
|
|
- concede_size['team_home'] = team_home
|
|
|
|
|
- concede_size['team_guest'] = team_guest
|
|
|
|
|
- concede_size['number'] = number
|
|
|
|
|
- concede_size['data_game'] = data_game
|
|
|
|
|
- concede_size['time_game'] = time_game
|
|
|
|
|
- concede_size['corner_ball'] = corner_ball
|
|
|
|
|
- concede_size['score_home'] = score_home
|
|
|
|
|
- concede_size['score_guest'] = score_guest
|
|
|
|
|
- concede_size['half_way'] = half_way
|
|
|
|
|
- concede_size['status'] = status
|
|
|
|
|
- concedelist[game_id] = concede_size
|
|
|
|
|
- # 让球大小盘
|
|
|
|
|
- item["concede_size"] = concedelist
|
|
|
|
|
-
|
|
|
|
|
- #全场独赢
|
|
|
|
|
- capot = {}
|
|
|
|
|
- # 全场独赢capot
|
|
|
|
|
- capots = new_result['o'].get('1x2', "")
|
|
|
|
|
- if capots:
|
|
|
|
|
- new_capots = [capots[i] for i in range(len(capots)) if i % 2 == 1]
|
|
|
|
|
- capot["capot_home"] = new_capots[0]
|
|
|
|
|
- capot["capot_guest"] = new_capots[1]
|
|
|
|
|
- capot["capot_dogfall"] = new_capots[2]
|
|
|
|
|
- else:
|
|
|
|
|
- capot["capot_home"] = ""
|
|
|
|
|
- capot["capot_guest"] = ""
|
|
|
|
|
- capot["capot_dogfall"] = ""
|
|
|
|
|
-
|
|
|
|
|
- #上半场独赢capot
|
|
|
|
|
- half_capots = new_result['o'].get('1x21st', "")
|
|
|
|
|
- if half_capots:
|
|
|
|
|
- new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
|
|
|
|
|
- capot["half_capot_home"] = new_half_capots[0]
|
|
|
|
|
- capot["half_capot_guest"] = new_half_capots[1]
|
|
|
|
|
- capot["half_capot_dogfall"] = new_half_capots[2]
|
|
|
|
|
- else:
|
|
|
|
|
- capot["half_capot_home"] = ""
|
|
|
|
|
- capot["half_capot_guest"] = ""
|
|
|
|
|
- capot["half_capot_dogfall"] = ""
|
|
|
|
|
- capot['league_id'] = league_id
|
|
|
|
|
- capot['league_name'] = league_name
|
|
|
|
|
- capot['game_id'] = game_id
|
|
|
|
|
- capot['team_home'] = team_home
|
|
|
|
|
- capot['team_guest'] = team_guest
|
|
|
|
|
- capot['number'] = number
|
|
|
|
|
- capot['data_game'] = data_game
|
|
|
|
|
- capot['time_game'] = time_game
|
|
|
|
|
- capot['corner_ball'] = corner_ball
|
|
|
|
|
- capot['score_home'] = score_home
|
|
|
|
|
- capot['score_guest'] = score_guest
|
|
|
|
|
- capot['half_way'] = half_way
|
|
|
|
|
- capot['status'] = status
|
|
|
|
|
- capotlist[game_id] = capot
|
|
|
|
|
- # 独赢
|
|
|
|
|
- item["capot"] = capotlist
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 全场入球:单/双
|
|
|
|
|
- odd_even = {}
|
|
|
|
|
- # 全场入球:单/双 odd_even
|
|
|
|
|
- odd_evens = new_result['o'].get('oe',"")
|
|
|
|
|
- if odd_evens:
|
|
|
|
|
- new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 == 1]
|
|
|
|
|
- odd_even["odd_even_odd"] = new_odd_evens[0] #全场单
|
|
|
|
|
- odd_even["odd_even_even"] = new_odd_evens[1] #全场双
|
|
|
|
|
- else:
|
|
|
|
|
- odd_even["odd_even_odd"] = ""
|
|
|
|
|
- odd_even["odd_even_even"] = ""
|
|
|
|
|
- # 半场入球:单/双 half_odd_even
|
|
|
|
|
- half_odd_evens = new_result['o'].get('oe1st',"")
|
|
|
|
|
- if half_odd_evens:
|
|
|
|
|
- new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 == 1]
|
|
|
|
|
- odd_even["half_odd_even_odd"] = new_half_odd_evens[0] #上半场单
|
|
|
|
|
- odd_even["half_odd_even_even"] = new_half_odd_evens[1] # 上半场双
|
|
|
|
|
- else:
|
|
|
|
|
- odd_even["half_odd_even_odd"] = "" #上半场单
|
|
|
|
|
- odd_even["half_odd_even_even"] = "" #上半场双
|
|
|
|
|
- odd_even['league_id'] = league_id
|
|
|
|
|
- odd_even['league_name'] = league_name
|
|
|
|
|
- odd_even['game_id'] = game_id
|
|
|
|
|
- odd_even['team_home'] = team_home
|
|
|
|
|
- odd_even['team_guest'] = team_guest
|
|
|
|
|
- odd_even['number'] = number
|
|
|
|
|
- odd_even['data_game'] = data_game
|
|
|
|
|
- odd_even['time_game'] = time_game
|
|
|
|
|
- odd_even['corner_ball'] = corner_ball
|
|
|
|
|
- odd_even['score_home'] = score_home
|
|
|
|
|
- odd_even['score_guest'] = score_guest
|
|
|
|
|
- odd_even['half_way'] = half_way
|
|
|
|
|
- odd_even['status'] = status
|
|
|
|
|
- oddevenlist[game_id] = odd_even
|
|
|
|
|
- # 入球数-单双
|
|
|
|
|
- item["odd_even"] = oddevenlist
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 全场总进球 total_goal
|
|
|
|
|
- total_goal = {}
|
|
|
|
|
- total_goals = new_result['o'].get('tg', "")
|
|
|
|
|
- if total_goals:
|
|
|
|
|
- new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 == 1]
|
|
|
|
|
- total_goal["total_goal_zero"] = new_total_goals[0]
|
|
|
|
|
- total_goal["total_goal_two"] = new_total_goals[1]
|
|
|
|
|
- total_goal["total_goal_four"] = new_total_goals[2]
|
|
|
|
|
- total_goal["total_goal_seven"] = new_total_goals[3]
|
|
|
|
|
- else:
|
|
|
|
|
- total_goal["total_goal_zero"] = ""
|
|
|
|
|
- total_goal["total_goal_two"] = ""
|
|
|
|
|
- total_goal["total_goal_four"] = ""
|
|
|
|
|
- total_goal["total_goal_seven"] = ""
|
|
|
|
|
-
|
|
|
|
|
- # 总进球上半场 half_total_goal
|
|
|
|
|
- half_total_goals = new_result['o'].get('tg1st', "")
|
|
|
|
|
- if half_total_goals:
|
|
|
|
|
- new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 == 1]
|
|
|
|
|
- total_goal["half_total_goal_zero"] = new_half_total_goals[0]
|
|
|
|
|
- total_goal["half_total_goal_one"] = new_half_total_goals[1]
|
|
|
|
|
- total_goal["half_total_goal_two"] = new_half_total_goals[2]
|
|
|
|
|
- total_goal["half_total_goal_three"] = new_half_total_goals[3]
|
|
|
|
|
- else:
|
|
|
|
|
- total_goal["half_total_goal_zero"] = ""
|
|
|
|
|
- total_goal["half_total_goal_one"] = ""
|
|
|
|
|
- total_goal["half_total_goal_two"] = ""
|
|
|
|
|
- total_goal["half_total_goal_three"] = ""
|
|
|
|
|
- total_goal['league_id'] = league_id
|
|
|
|
|
- total_goal['league_name'] = league_name
|
|
|
|
|
- total_goal['game_id'] = game_id
|
|
|
|
|
- total_goal['team_home'] = team_home
|
|
|
|
|
- total_goal['team_guest'] = team_guest
|
|
|
|
|
- total_goal['number'] = number
|
|
|
|
|
- total_goal['data_game'] = data_game
|
|
|
|
|
- total_goal['time_game'] = time_game
|
|
|
|
|
- total_goal['corner_ball'] = corner_ball
|
|
|
|
|
- total_goal['score_home'] = score_home
|
|
|
|
|
- total_goal['score_guest'] = score_guest
|
|
|
|
|
- total_goal['status'] = status
|
|
|
|
|
- total_goal['half_way'] = half_way
|
|
|
|
|
- totalgoallist[game_id] = total_goal
|
|
|
|
|
- #总入球
|
|
|
|
|
- item["total_goal"] = totalgoallist
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 早盘 半场/全场
|
|
|
|
|
- half_full = {}
|
|
|
|
|
- new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest", "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest", "half_full_guest_home","half_full_guest_dogfall", "half_full_guest_guest"]
|
|
|
|
|
- half_fulls = new_result['o'].get('hf', "")
|
|
|
|
|
- if half_fulls:
|
|
|
|
|
- new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 == 1]
|
|
|
|
|
- for index, value in enumerate(new_lists):
|
|
|
|
|
- half_full[value] = new_half_fulls[index]
|
|
|
|
|
- else:
|
|
|
|
|
- for index, value in enumerate(new_lists):
|
|
|
|
|
- half_full[value] = ""
|
|
|
|
|
- half_full['league_id'] = league_id
|
|
|
|
|
- half_full['league_name'] = league_name
|
|
|
|
|
- half_full['game_id'] = game_id
|
|
|
|
|
- half_full['team_home'] = team_home
|
|
|
|
|
- half_full['team_guest'] = team_guest
|
|
|
|
|
- half_full['number'] = number
|
|
|
|
|
- half_full['data_game'] = data_game
|
|
|
|
|
- half_full['time_game'] = time_game
|
|
|
|
|
- half_full['corner_ball'] = corner_ball
|
|
|
|
|
- half_full['score_home'] = score_home
|
|
|
|
|
- half_full['score_guest'] = score_guest
|
|
|
|
|
- half_full['half_way'] = half_way
|
|
|
|
|
- half_full['status'] = status
|
|
|
|
|
- halffulllist[game_id] = half_full
|
|
|
|
|
- #半场/全场
|
|
|
|
|
- item["half_full"] = halffulllist
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 波胆
|
|
|
|
|
- bodan = {}
|
|
|
|
|
- bodan_data = {}
|
|
|
|
|
- half_bodan_data = {}
|
|
|
|
|
- bodans = new_result['o'].get('cs', "")
|
|
|
|
|
- if bodans:
|
|
|
|
|
- one_list = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two","bodan_home_four_zero","bodan_home_four_one","bodan_home_four_two","bodan_home_four_three"]
|
|
|
|
|
- two_list = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two","bodan_guest_four_zero","bodan_guest_four_one","bodan_guest_four_two","bodan_guest_four_three"]
|
|
|
|
|
- three_list = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three","bodan_dogfall_four_four"]
|
|
|
|
|
- new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 == 1]
|
|
|
|
|
- new_bodan = new_bodans[0:20]
|
|
|
|
|
- # 主队bodan_home
|
|
|
|
|
- bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 0]
|
|
|
|
|
- for index, t in enumerate(one_list):
|
|
|
|
|
- bodan_data[t] = bodan_home[index]
|
|
|
|
|
- # 客队bodan_guest
|
|
|
|
|
- bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 1]
|
|
|
|
|
- for y, z in enumerate(two_list):
|
|
|
|
|
- bodan_data[z] = bodan_guest[y]
|
|
|
|
|
- bodan_dogfall = new_bodans[-7:-2]
|
|
|
|
|
- for a, b in enumerate(three_list):
|
|
|
|
|
- bodan_data[b] = bodan_dogfall[a]
|
|
|
|
|
- # 其他bodan_other
|
|
|
|
|
- bodan_data['bodan_other'] = new_bodans[-1]
|
|
|
|
|
- bodan['bodan'] = bodan_data
|
|
|
|
|
- else:
|
|
|
|
|
- bodan["bodan"] = ""
|
|
|
|
|
- half_bodans = new_result['o'].get('cs1st', "")
|
|
|
|
|
- if half_bodans:
|
|
|
|
|
- new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 == 1]
|
|
|
|
|
- new_one = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two"]
|
|
|
|
|
- new_two = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two"]
|
|
|
|
|
- new_three = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three"]
|
|
|
|
|
- halfbodan = new_half_bodans[0:12]
|
|
|
|
|
- half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 0]
|
|
|
|
|
- # 队1
|
|
|
|
|
- for index, t in enumerate(new_one):
|
|
|
|
|
- half_bodan_data[t] = half_bodan_home[index]
|
|
|
|
|
- # 队2
|
|
|
|
|
- half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 1]
|
|
|
|
|
- for y, z in enumerate(new_two):
|
|
|
|
|
- half_bodan_data[z] = half_bodan_guest[y]
|
|
|
|
|
- # 和/平
|
|
|
|
|
- half_bodan_dogfall = new_half_bodans[-6:-2]
|
|
|
|
|
- for a, b in enumerate(new_three):
|
|
|
|
|
- half_bodan_data[b] = half_bodan_dogfall[a]
|
|
|
|
|
- # 其他
|
|
|
|
|
- half_bodan_data['bodan_other'] = new_half_bodans[-1]
|
|
|
|
|
- bodan["half_bodan"] = half_bodan_data
|
|
|
|
|
- else:
|
|
|
|
|
- bodan['half_bodan'] = ""
|
|
|
|
|
- bodan['league_id'] = league_id
|
|
|
|
|
- bodan['league_name'] = league_name
|
|
|
|
|
- bodan['game_id'] = game_id
|
|
|
|
|
- bodan['team_home'] = team_home
|
|
|
|
|
- bodan['team_guest'] = team_guest
|
|
|
|
|
- bodan['number'] = number
|
|
|
|
|
- bodan['data_game'] = data_game
|
|
|
|
|
- bodan['time_game'] = time_game
|
|
|
|
|
- bodan['corner_ball'] = corner_ball
|
|
|
|
|
- bodan['status'] = status
|
|
|
|
|
- bodan['score_home'] = score_home
|
|
|
|
|
- bodan['score_guest'] = score_guest
|
|
|
|
|
- bodan['half_way'] = half_way
|
|
|
|
|
- bodanlist[game_id] = bodan
|
|
|
|
|
- item["bodan"] = bodanlist
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # 早盘 最先/最后进球
|
|
|
|
|
- first_last_ball = {}
|
|
|
|
|
- # 早盘 最先/最后进球 最先进球
|
|
|
|
|
- first_balls = new_result['o'].get('ttslast', "")
|
|
|
|
|
- if first_balls:
|
|
|
|
|
- first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 == 1]
|
|
|
|
|
- first_last_ball['first_ball_home'] = first_ball[0]
|
|
|
|
|
- first_last_ball['first_ball_guest'] = first_ball[1]
|
|
|
|
|
- else:
|
|
|
|
|
- first_last_ball['first_ball_home'] = ""
|
|
|
|
|
- first_last_ball['first_ball_guest'] = ""
|
|
|
|
|
- # 早盘 最先/最后进球 最后进球
|
|
|
|
|
- last_balls = new_result['o'].get('tts1st', "")
|
|
|
|
|
- if last_balls:
|
|
|
|
|
- last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 == 1]
|
|
|
|
|
- first_last_ball['last_ball_home'] = last_ball[0]
|
|
|
|
|
- first_last_ball['last_ball_guest'] = last_ball[1]
|
|
|
|
|
- first_last_ball['not_ball'] = last_ball[2]
|
|
|
|
|
- else:
|
|
|
|
|
- first_last_ball['last_ball_home'] = ""
|
|
|
|
|
- first_last_ball['last_ball_guest'] = ""
|
|
|
|
|
- first_last_ball['not_ball'] = ""
|
|
|
|
|
- first_last_ball['league_id'] = league_id
|
|
|
|
|
- first_last_ball['league_name'] = league_name
|
|
|
|
|
- first_last_ball['game_id'] = game_id
|
|
|
|
|
- first_last_ball['team_home'] = team_home
|
|
|
|
|
- first_last_ball['team_guest'] = team_guest
|
|
|
|
|
- first_last_ball['number'] = number
|
|
|
|
|
- first_last_ball['data_game'] = data_game
|
|
|
|
|
- first_last_ball['time_game'] = time_game
|
|
|
|
|
- first_last_ball['corner_ball'] = corner_ball
|
|
|
|
|
- first_last_ball['score_home'] = score_home
|
|
|
|
|
- first_last_ball['score_guest'] = score_guest
|
|
|
|
|
- first_last_ball['half_way'] = half_way
|
|
|
|
|
- first_last_ball['status'] = status
|
|
|
|
|
- firstlastballlist[game_id] = first_last_ball
|
|
|
|
|
- # 最先/最后进球
|
|
|
|
|
- item["first_last_ball"] = firstlastballlist
|
|
|
|
|
- yield item
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # print(type(datas))
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # item = Hg3535Item()
|
|
|
|
|
- # ids = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') # ids新列表
|
|
|
|
|
- # if ids:
|
|
|
|
|
- # ids1 = set(ids)#去重
|
|
|
|
|
- # for i in ids1:
|
|
|
|
|
- # urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
|
|
|
|
|
- # print(urls)
|
|
|
|
|
- # yield Request(url=urls, callback=self.parse_each)
|
|
|
|
|
- # s_k = reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.k')) # s字典下面的k 数字
|
|
|
|
|
- # s_n= reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.n')) # s字典下面的n
|
|
|
|
|
-
|
|
|
|
|
- # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
|
|
|
|
|
- # c_ks= jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..k')#递归查找c字典下面k的值返回列表
|
|
|
|
|
- # c_kns = jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..n')#递归查找c字典下面的n返回列表
|
|
|
|
|
-
|
|
|
|
|
- # es_i_0s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[0]') #递归查找队1名
|
|
|
|
|
- # es_i_1s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[1]') # 递归查找队2名
|
|
|
|
|
- # es_i_2s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[2]') # 递归查找num
|
|
|
|
|
- # es_i_4s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[4]') # 递归查找比赛日期
|
|
|
|
|
- # es_i_5s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[5]') # 比赛时间
|
|
|
|
|
- # es_i_10s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[10]') #队一比分
|
|
|
|
|
- # es_i_11s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[11]') # 队二比分
|
|
|
|
|
- # es_i_12s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[12]') # 半场
|
|
|
|
|
- # es_i_16s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') #比赛id
|
|
|
|
|
- # o_ah1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o ah 列表
|
|
|
|
|
- # o_ou1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o ou 列表
|
|
|
|
|
- # o_1x2s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x2[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1X2 列表 并不是一定存在
|
|
|
|
|
- # o_ahlsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o ah1st 列表 并不是一定存在
|
|
|
|
|
- # o_ou1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o oulst 列表 并不是一定存在
|
|
|
|
|
- # o_1x21sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x21st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_oes = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oe[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_oelsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oelst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_tgs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tg[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_tglsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tglst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_hfs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..hf[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_css = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cs[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_cslsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cslst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_ttslasts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ttslast[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
- # o_tts1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tts1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o 1x2lst 列表 并不是一定存在
|
|
|
|
|
-
|
|
|
|
|
- # item['league_id'] = s_k
|
|
|
|
|
- # item['league_name'] = s_n
|
|
|
|
|
- # item['ctn'] = pci_ctn
|
|
|
|
|
- # item['one_team_name'] = es_i_0s
|
|
|
|
|
- # item['two_team_name'] = es_i_1s
|
|
|
|
|
- # item['num'] = es_i_2s
|
|
|
|
|
- # item['date_match'] = es_i_4s
|
|
|
|
|
- # item['date_time'] = es_i_5s
|
|
|
|
|
- # item['one_team_score'] = es_i_10s
|
|
|
|
|
- # item['two_team_score'] = es_i_11s
|
|
|
|
|
- # item['half_time'] = es_i_12s
|
|
|
|
|
- # item['match_id'] = es_i_16s
|
|
|
|
|
- # item['give_ball'] = o_ah1s
|
|
|
|
|
- # item['full_size'] = o_ou1s
|
|
|
|
|
- # item['win_situation'] = o_1x2s
|
|
|
|
|
- # item['half_handicap'] = o_ahlsts
|
|
|
|
|
- # item['half_size'] = o_ou1sts
|
|
|
|
|
- # item['half_win'] = o_1x21sts
|
|
|
|
|
- # item['full_score'] = o_oes
|
|
|
|
|
- # item['half_goal'] = o_oelsts
|
|
|
|
|
- # item['total_goal'] = o_tgs
|
|
|
|
|
- # item['first_half_goal'] = o_tglsts
|
|
|
|
|
- # item['half_full_time'] = o_hfs
|
|
|
|
|
- # item['full_field'] = o_css
|
|
|
|
|
- # item['half_wave'] = o_cslsts
|
|
|
|
|
- # item['advanced_ball'] = o_ttslasts
|
|
|
|
|
- # item['final_goal'] = o_tts1sts
|
|
|
|
|
- #
|
|
|
|
|
- # yield item
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # s_k = ("".join('%s' %id for id in s_k))#列表内数字转成字符串1
|
|
|
|
|
- # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
|
|
|
|
|
- # es_i1_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[0]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i1_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[1]'))
|
|
|
|
|
- # es_i1_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[2]'))
|
|
|
|
|
- # es_i1_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[4]'))
|
|
|
|
|
- # es_i1_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[5]'))
|
|
|
|
|
- # es_i1_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[10]'))
|
|
|
|
|
- # es_i1_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[11]'))
|
|
|
|
|
- # es_i1_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[12]'))
|
|
|
|
|
- # es_i1_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[16]'))
|
|
|
|
|
- # es_i2_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[0]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[1]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[2]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[4]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[5]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[10]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[11]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[12]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # es_i2_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[16]'))#i1 代表es下的第一个i i2第二个
|
|
|
|
|
- # o_ah1 = jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0]..o..ah[1,3,5,7,9,11,13,15,17,19,21]')#o字典下 ah 取奇数是个列表
|
|
|
|
|
- #
|
|
|
|
|
- # print(s_k)
|
|
|
|
|
-
|
|
|
|
|
- # pass
|
|
|
|
|
- # item = DoubanItem()
|
|
|
|
|
- # item['movie_name'] = response.xpath('//span[@property="v:itemreviewed"]/text()').extract()
|
|
|
|
|
- # item['movie_director'] = response.xpath('//a[@rel="v:directedBy"]/text()').extract()
|
|
|
|
|
- # item['movie_starring'] = response.xpath('//a[@rel="v:starring"]/text()').extract()
|
|
|
|
|
- # item['movie_category'] = response.xpath('//span[@property="v:genre"]/text()').extract()
|
|
|
|
|
- # item['movie_time'] = response.xpath('//span[@property="v:runtime"]/text()').extract()
|
|
|
|
|
- # item['movie_star'] = response.xpath('//strong[@property="v:average"]/text()').extract()
|
|
|
|
|
- # item['movie_5score'] = response.xpath('//span[@class="rating_per"][1]/text()').extract()
|
|
|
|
|
- # item['movie_4score'] = response.xpath('//span[@class="rating_per"][2]/text()').extract()
|
|
|
|
|
- # item['movie_3score'] = response.xpath('//span[@class="rating_per"][3]/text()').extract()
|
|
|
|
|
- # item['movie_2score'] = response.xpath('//span[@class="rating_per"][4]/text()').extract()
|
|
|
|
|
- # item['movie_1score'] = response.xpath('//span[@class="rating_per"][5]/text()').extract()
|
|
|
|
|
- # yield item
|
|
|
|
|
-
|
|
|
|
|
- # def parse_each(self,response):
|
|
|
|
|
- # res = json.loads(response.text)
|
|
|
|
|
- # eg_c_k = jsonpath.jsonpath(res, '$..eg.c.k')
|
|
|
|
|
- # eg_c_n = jsonpath.jsonpath(res, '$..eg.c.n')
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # pass
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- # def parse_other(self, response):
|
|
|
|
|
- # print(response)
|
|
|
|
|
- # # 球队进球数 大小
|
|
|
|
|
- # try:
|
|
|
|
|
- # datas = json.loads(response.text)['eg']['es']
|
|
|
|
|
- # league_id = json.loads(response.text)['eg']['c']['k']
|
|
|
|
|
- # # 联赛名
|
|
|
|
|
- # league_name = json.loads(response.text)['eg']['c']['n']
|
|
|
|
|
- # except:
|
|
|
|
|
- # datas = ""
|
|
|
|
|
- # league_id = ""
|
|
|
|
|
- # # 联赛名
|
|
|
|
|
- # league_name = ""
|
|
|
|
|
- # if datas:
|
|
|
|
|
- # item = Temaball()
|
|
|
|
|
- # full_dict = {}
|
|
|
|
|
- # half_dict = {}
|
|
|
|
|
- # full_dict_rule = {}
|
|
|
|
|
- # half_dict_rule = {}
|
|
|
|
|
- # data_list = []
|
|
|
|
|
- # for data in datas:
|
|
|
|
|
- # try:
|
|
|
|
|
- # new_data = data['pci']['ctid']
|
|
|
|
|
- # except:
|
|
|
|
|
- # new_data = ""
|
|
|
|
|
- # pass
|
|
|
|
|
- # if new_data == 0:
|
|
|
|
|
- # # 比赛id
|
|
|
|
|
- # game_id = str(data['k'])
|
|
|
|
|
- # data_list.append(game_id)
|
|
|
|
|
- # # 球队1
|
|
|
|
|
- # team_home = data['i'][0]
|
|
|
|
|
- # data_list.append(team_home)
|
|
|
|
|
- # # 球队2
|
|
|
|
|
- # team_guest = data['i'][1]
|
|
|
|
|
- # data_list.append(team_guest)
|
|
|
|
|
- # # 数量(97>)
|
|
|
|
|
- # number = data['i'][2]
|
|
|
|
|
- # data_list.append(number)
|
|
|
|
|
- # # 状态
|
|
|
|
|
- # # zhuangtai = data['i'][3]
|
|
|
|
|
- #
|
|
|
|
|
- # # 日期
|
|
|
|
|
- # data_game = data['i'][4]
|
|
|
|
|
- # data_list.append(data_game)
|
|
|
|
|
- # # 开赛时间
|
|
|
|
|
- # time_game = data['i'][5]
|
|
|
|
|
- # data_list.append(time_game)
|
|
|
|
|
- # if new_data == 12:
|
|
|
|
|
- # try:
|
|
|
|
|
- # home_data = data['o']['ou']['v']
|
|
|
|
|
- #
|
|
|
|
|
- # # 球队进球 大条件
|
|
|
|
|
- # home_size_big_rule = home_data[1]
|
|
|
|
|
- # full_dict_rule['home_size_big'] = home_size_big_rule
|
|
|
|
|
- #
|
|
|
|
|
- # # 球队进球大赔率
|
|
|
|
|
- # home_size_big = home_data[5]
|
|
|
|
|
- # full_dict['home_size_big'] = home_size_big
|
|
|
|
|
- #
|
|
|
|
|
- # # 球队进球小条件
|
|
|
|
|
- # home_size_small_rule = home_data[3]
|
|
|
|
|
- # full_dict_rule['home_size_small'] = home_size_small_rule
|
|
|
|
|
- #
|
|
|
|
|
- # # 球队进球小赔率
|
|
|
|
|
- # home_size_small = home_data[7]
|
|
|
|
|
- # full_dict['home_size_small'] = home_size_small
|
|
|
|
|
- # except:
|
|
|
|
|
- # full_dict['home_size_small'] = ""
|
|
|
|
|
- # full_dict_rule['home_size_small'] = ""
|
|
|
|
|
- #
|
|
|
|
|
- # full_dict['home_size_big'] = ""
|
|
|
|
|
- # full_dict_rule['home_size_big'] = ""
|
|
|
|
|
- # try:
|
|
|
|
|
- # half_home_data = data['o']['ou1st']['v']
|
|
|
|
|
- #
|
|
|
|
|
- # half_home_size_big_rule = half_home_data[1]
|
|
|
|
|
- # half_dict_rule['half_home_size_big'] = half_home_size_big_rule
|
|
|
|
|
- #
|
|
|
|
|
- # half_home_size_big = half_home_data[5]
|
|
|
|
|
- # half_dict['half_home_size_big'] = half_home_size_big
|
|
|
|
|
- #
|
|
|
|
|
- # half_home_size_small_rule = half_home_data[3]
|
|
|
|
|
- # half_dict_rule['half_home_size_small'] = half_home_size_small_rule
|
|
|
|
|
- #
|
|
|
|
|
- # half_home_size_small = half_home_data[7]
|
|
|
|
|
- # half_dict['half_home_size_small'] = half_home_size_small
|
|
|
|
|
- #
|
|
|
|
|
- # except:
|
|
|
|
|
- # half_dict_rule['half_home_size_big'] = ""
|
|
|
|
|
- # half_dict['half_home_size_big'] = ""
|
|
|
|
|
- #
|
|
|
|
|
- # half_dict_rule['half_home_size_small'] = ""
|
|
|
|
|
- # half_dict['half_home_size_small'] = ""
|
|
|
|
|
- #
|
|
|
|
|
- # if new_data == 13:
|
|
|
|
|
- # try:
|
|
|
|
|
- # guest_data = data['o']['ou']['v']
|
|
|
|
|
- #
|
|
|
|
|
- # guest_size_big_rule = guest_data[1]
|
|
|
|
|
- # full_dict_rule['guest_size_big'] = guest_size_big_rule
|
|
|
|
|
- #
|
|
|
|
|
- # guest_size_big = guest_data[5]
|
|
|
|
|
- # full_dict['guest_size_big'] = guest_size_big
|
|
|
|
|
- #
|
|
|
|
|
- # guest_size_small_rule = guest_data[3]
|
|
|
|
|
- # full_dict_rule['guest_size_small'] = guest_size_small_rule
|
|
|
|
|
- #
|
|
|
|
|
- # guest_size_small = guest_data[7]
|
|
|
|
|
- # full_dict['guest_size_small'] = guest_size_small
|
|
|
|
|
- # except:
|
|
|
|
|
- # full_dict_rule['guest_size_big'] = ""
|
|
|
|
|
- # full_dict['guest_size_big'] = ""
|
|
|
|
|
- #
|
|
|
|
|
- # full_dict_rule['guest_size_small'] = ""
|
|
|
|
|
- # full_dict['guest_size_small'] = ''
|
|
|
|
|
- # try:
|
|
|
|
|
- # half_guest_data = data['o']['ou1st']['v']
|
|
|
|
|
- #
|
|
|
|
|
- # half_guest_size_big_rule = half_guest_data[1]
|
|
|
|
|
- # half_dict_rule['half_guest_size_big'] = half_guest_size_big_rule
|
|
|
|
|
- #
|
|
|
|
|
- # half_guest_size_big = half_guest_data[5]
|
|
|
|
|
- # half_dict['half_guest_size_big'] = half_guest_size_big
|
|
|
|
|
- #
|
|
|
|
|
- # half_guest_size_small_rule = half_guest_data[3]
|
|
|
|
|
- # half_dict_rule['half_guest_size_small'] = half_guest_size_small_rule
|
|
|
|
|
- #
|
|
|
|
|
- # half_guest_size_small = half_guest_data[7]
|
|
|
|
|
- # half_dict['half_guest_size_small'] = half_guest_size_small
|
|
|
|
|
- # except:
|
|
|
|
|
- # half_dict_rule['half_guest_size_big'] = ""
|
|
|
|
|
- # half_dict['half_guest_size_big'] = ""
|
|
|
|
|
- #
|
|
|
|
|
- # half_dict_rule['half_guest_size_small'] = ""
|
|
|
|
|
- # half_dict['half_guest_size_small'] = ""
|
|
|
|
|
- # #
|
|
|
|
|
- # item['league_id'] = league_id
|
|
|
|
|
- # item['league_name'] = league_name
|
|
|
|
|
- # item['game_id'] = data_list[0]
|
|
|
|
|
- # item['team_home'] = data_list[1]
|
|
|
|
|
- # item['team_guest'] = data_list[2]
|
|
|
|
|
- # item['number'] = data_list[3]
|
|
|
|
|
- # item['data_game'] = data_list[4]
|
|
|
|
|
- # item['time_game'] = data_list[5]
|
|
|
|
|
- # item['full_data'] = full_dict
|
|
|
|
|
- # item['half_data'] = half_dict
|
|
|
|
|
- # item['full_data_rule'] = full_dict_rule
|
|
|
|
|
- # item['half_data_rule'] = half_dict_rule
|
|
|
|
|
- # yield item
|
|
|