Skip to content

Commit

Permalink
update mes
Browse files Browse the repository at this point in the history
  • Loading branch information
leriou committed Jan 23, 2019
1 parent 979ba79 commit 23eec93
Showing 1 changed file with 14 additions and 31 deletions.
45 changes: 14 additions & 31 deletions zgzcw.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,25 @@ def analysis_list(self, url):
if self.tools.check_url_success(url):
return False
dom = self.tools.get_dom_obj(url)

for tr in dom.select(".endBet") + dom.select(".beginBet"):
newplayid = tr.select(".wh-10")[0].get("newplayid")
bjop = self.analysis_bjop(self.get_module_url("bjop", newplayid))
if bjop:
odds = {}
for wh in tr.select(".wh-8 .tz-area"):
if wh.select("a")[0].text == "未开售":
od = {"rq":wh.select(".rq")[0].string,"odds":False}
od = {
"rq":wh.select(".rq")[0].string,
"odds":False,
"comment": "未开售"
}
else:
od = {
"rq":wh.select(".rq")[0].string,
"odds":True,
"win":wh.select("a")[0].text,
"eq":wh.select("a")[1].text,
"lost":wh.select("a")[2].text
"win": wh.select("a")[0].text,
"eq": wh.select("a")[1].text,
"lost": wh.select("a")[2].text
}
odds[od["rq"]] = (od)
match = {
Expand All @@ -104,12 +107,12 @@ def analysis_list(self, url):
"match_result":bjop["match_result"],
"created_time":self.tools.get_time(),
"bjop":{
"id":tr.select(".wh-10")[0].get("newplayid"),
"url":bjop["url"]
"id": int(newplayid),
"url": bjop["url"]
},
"odds":odds,
"rates":bjop["rates"],
"estimate":self.estimate(bjop["rates"])
"odds": odds,
"rates": bjop["rates"],
"timestamp": time.time()
}
match_list.append(match)
self.tools.marked_url_success(url, True)
Expand Down Expand Up @@ -194,24 +197,4 @@ def check_bjop_done(self,url):
return self.db.find_one({"bjop.url":url})

def date_has_done(self, date):
return self.logdb.find_one({"date": date})

def estimate(self, data): # 根据历史记录统计某赔率下的胜率
arr = ["Interwetten","竞彩官方(胜平负)"]
rt = {}
for key in arr:
if data.get(key):
rs = self.db.find({
"rates."+key+".begin":data[key]["begin"]
})
ret = {
"0":0,
"1":0,
"3":0
}
for r in rs:
ret[str(r["match_result"])] += 1
rt[key] = ret
return rt


return self.logdb.find_one({"date": date})

0 comments on commit 23eec93

Please sign in to comment.