juan 6 éve
szülő
commit
2417267a72
1 módosított fájl, 49 hozzáadás és 48 törlés
  1. 49 48
      hgg070_spider/spiders/lq_sports.py

+ 49 - 48
hgg070_spider/spiders/lq_sports.py

@@ -39,7 +39,7 @@ class LqSportsSpider(scrapy.Spider):
         for item in h_types:
             showtype = item
             data={
-                'uid': '1c721b7a80b72068ee7217348356d79160e0d97f2e34c98b3e12ea33355066b6',
+                'uid': '3970335d20df9b8ceca8673ae9b6ea910c912492f595c0ef163623ae0ea883b6',
                 'langx': 'zh-cn',
                 'ltype': '3',
                 'gtype': 'BK',
@@ -101,53 +101,54 @@ class LqSportsSpider(scrapy.Spider):
                 data = []
                 for hg in hgg:
                     items=hg['items']
-                    for x in items:
-                        odds_code = gl[x['rodds']]
-                        p_code = gl[x['prodds']]
-                        odds=gl["ior_OUH"]
+                    if gl[hg['prodds']]=='Y':
+                        for x in items:
+                            odds_code = gl[x['rodds']]
+                            p_code = gl[hg['prodds']]
+                            odds=gl["ior_OUH"]
+                            #有两个条件,加两条数据
+                            if x['ratio_name']:      #大的
+                                condition_u=gl[x['ratio_name']]
+                                odds_only = hg["plodds"] + x["lodds"] + '0' + condition_u + str(odds) + "hg3535" + str(match_id)
+                                sole = hg["plodds"] + x["lodds"] + '0' + str(match_id) + "hg3535"
+                                tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
+                                        "sort": 0, "p_code": p_code,
+                                        "odds": odds, "condition": condition_u, "odds_only": odds_only, "sole": sole,
+                                        "source": "hgg070", "type": 0, "team": ""}
+                                data.append(tobj)
 
-                        #有两个条件,加两条数据
-                        if x['ratio_name']:      #大的
-                            condition_u=gl[x['ratio_name']]
-                            odds_only = gl[x["prodds"]] + gl[x["rodds"]] + '0' + condition_u + str(odds) + "hg3535" + str(match_id)
-                            sole = gl[x["prodds"]] + gl[x["rodds"]] + '0' + str(match_id) + "hg3535"
-                            tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
-                                    "sort": 0, "p_code": p_code,
-                                    "odds": odds, "condition": condition_u, "odds_only": odds_only, "sole": sole,
-                                    "source": "hgg070", "type": 0, "team": ""}
-                            data.append(tobj)
+                            if x['latio']:   #小的
+                                condition_s = gl[x['latio']]
+                                odds_only =hg["plodds"] + x["lodds"] + '0' +condition_s + str(odds) + "hg3535" + str(match_id)
+                                sole = hg["plodds"] + x["lodds"] + '0' + str(match_id) + "hg3535"
+                                tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
+                                        "sort": 0, "p_code": p_code,
+                                        "odds": odds,"condition": condition_s, "odds_only": odds_only, "sole": sole,
+                                        "source": "hgg070", "type": 0, "team": ""}
+                                data.append(tobj)
 
-                        if x['latio']:   #小的
-                            condition_s = gl[x['latio']]
-                            odds_only = gl[x["prodds"]] + gl[x["rodds"]] + '0' +condition_s + str(odds) + "hg3535" + str(match_id)
-                            sole = gl[x["prodds"]] + gl[x["rodds"]] + '0' + str(match_id) + "hg3535"
-                            tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
-                                    "sort": 0, "p_code": p_code,
-                                    "odds": odds,"condition": condition_s, "odds_only": odds_only, "sole": sole,
-                                    "source": "hgg070", "type": 0, "team": ""}
-                            data.append(tobj)
+                            if not x['latio'] and not x['ratio_name']:
+                                condition_s = ''
+                                odds_only = hg["plodds"] + x["lodds"] + '0' +condition_s + str(odds) + "hg3535" + str(match_id)
+                                sole = hg["plodds"] + x["lodds"] + '0' + str(match_id) + "hg3535"
+                                tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
+                                        "sort": 0, "p_code": p_code,
+                                        "odds": odds,"condition": condition_s, "odds_only": odds_only, "sole": sole,
+                                        "source": "hgg070", "type": 0, "team": ""}
+                                data.append(tobj)
 
-                        if not x['latio'] and not x['ratio_name']:
-                            condition_s = ''
-                            odds_only = gl[x["prodds"]] + gl[x["rodds"]] + '0' +condition_s + str(odds) + "hg3535" + str(match_id)
-                            sole = gl[x["prodds"]] + gl[x["rodds"]] + '0' + str(match_id) + "hg3535"
-                            tobj = {"match_id": match_id, "lg_id": league_id, "odds_code": odds_code, "status": 0,
-                                    "sort": 0, "p_code": p_code,
-                                    "odds": odds,"condition": condition_s, "odds_only": odds_only, "sole": sole,
-                                    "source": "hgg070", "type": 0, "team": ""}
-                            data.append(tobj)
-
-                item = LanqiuItem()
-                item['match_id'] = match_id
-                item['source'] = "hg0088"
-                item['updata'] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                item['content'] = data
-                item['league_id'] = league_id
-                item['more_count'] = more_count
-                item['league'] = gl["league"]
-                item['match_identity'] = match_uid
-                item['datetime'] = datetime
-                item['team_h'] = team_h
-                item['team_c'] = team_c
-                item['isP'] = isP
-                yield item
+                    item = LanqiuItem()
+                    item['match_id'] = match_id
+                    item['source'] = "hg0088"
+                    item['updata'] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+                    item['content'] = data
+                    item['league_id'] = league_id
+                    item['more_count'] = more_count
+                    item['league'] = gl["league"]
+                    item['match_identity'] = match_uid
+                    item['datetime'] = datetime
+                    item['team_h'] = team_h
+                    item['team_c'] = team_c
+                    item['isP'] = isP
+                    print('wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww',item)
+                    yield item