Bladeren bron

新增足球滚球爬虫

Your Name 6 jaren geleden
bovenliggende
commit
0c0ef5a614

+ 24 - 11
hgg070_spider/pipelines/roll_zuqiu.py

@@ -57,14 +57,20 @@ class RollPipeline(object):
         json_key = 'zq_rollball'
         match_list = []
         match_identity = Helper.genearte_uuid(team_h + team_c + match_date)
+        ptype_id = match_all.get('ptype_id')
+        is_horn = 0
+        if ptype_id == '146':
+            ptype = match_all['ptype']
+            team_h = team_h.replace(ptype, '').strip()
+            team_c = team_c.replace(ptype, '').strip()
+            is_horn = 1
         if self.db.zq_competition070.find({'match_id': match_id, 'is_rollball': 1}).count() < 1:
             match_dict = {"game_code": "zq", "title": "match", "source": "hgg070"}
             match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
                          "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
                          "half_match_id", "is_today", "is_horn", 'match_identity']
             match_value = [team_h, team_c, league_id, 0, match_id, match_date, match_time, tag_number,
-                           "hgg070", 1, 0, 0, us_time, uuid, 0, 0, 0,
-                           match_identity]
+                           "hgg070", 1, 0, 0, us_time, uuid, 0, 0, is_horn, match_identity]
             match_data = dict(zip(match_kay, match_value))
             match_list.append(match_data)
             match_dict['data'] = match_list
@@ -125,23 +131,30 @@ class RollPipeline(object):
                 logging.warning('足球详细赔率接口异常, {}'.format(res))
         else:
             logger.info('足球详细赔率列表为空')
-        data_list = []
+        data_result = []
+        process = {"HT": "半场", "1H": "上半场", "2H": "下半场"}
+        match_process = process[re_time.split('^')[0]]
+        time_game = re_time.split('^')[1][:-1]
+        score_h = match_all.get('score_h')
+        score_c = match_all.get('score_c')
+        # all_goal = score_h + score_c
+        # match_score = '{}:{}'.format(score_h, score_c)
         zq_rball = {"home_team": team_h, "guest_team": team_c,
                     "lg_id": league_id, "home_rate": 0,
-                    "guest_rate": 0, "home_score": score_home,
-                    "guest_score": score_guest, "all_goal": all_goal, "status": 1,
-                    "first_score": "", "last_score": "", "match_score": match_score, "uuid": uuid,
+                    "guest_rate": 0, "home_score": score_h,
+                    "guest_score": score_c, "all_goal": '', "status": 1,
+                    "first_score": "", "last_score": "", "match_score": '', "uuid": uuid,
                     "match_winer": "", "match_time": time_game, 'match_identity': match_identity,
-                    "match_process": half_way, "tag": number,
+                    "match_process": match_process, "tag": tag_number,
                     "match_id": match_id, "p_code": ""}
-        data_list.append(zq_rball)
+        data_result.append(zq_rball)
         r_data_dict = {
             "game_code": "zq",
             "title": "match_result_r",
-            "source": "hg3535",
-            "data": data_list
+            "source": "hgg070",
+            "data": data_result
         }
-        if data_list:
+        if data_result:
             try:
                 res = Helper.async_post(MATCH_RESULT, r_data_dict)
                 if res:

+ 2 - 1
hgg070_spider/settings.py

@@ -103,7 +103,8 @@ MATCH_URL = 'http://admin.5gogo.com/setMatch'  #赛事
 ODDS_URL = 'http://admin.5gogo.com/setOdds'  #赔率
 # ODDS_URL = 'http://stadmin.bocai108.com/setOdds'
 TOKEN_URL = "http://admin.5gogo.com/getToken"  #Token
-MATCH_RESULT = "http://stadmin.bocai108.com:19093/setMatchResult"
+# MATCH_RESULT = "http://stadmin.bocai108.com:19093/setMatchResult"
+MATCH_RESULT = "http://admin.5gogo.com/setMatchResult"
 MATCH_STATUS = "http://stadmin.bocai108.com:19093/upMatch"
 ODDSCH = "http://stadmin.bocai108.com:19093/setOddsCH"
 SAIGUO_RESULT = "http://stadmin.bocai108.com:19093/setResultExpress"

+ 3 - 3
hgg070_spider/spiders/roll_zuqiu.py

@@ -35,7 +35,7 @@ class ZuqiuSpider(scrapy.Spider):
     def start_requests(self):
         url = "http://m.hgg070.com/app/member/get_league_list.php"
         from_data = {
-            'uid': '9965a18b03dc6aacf12290bd5b8267fd7e38ec76eadf899b6108e82da5974cdd',
+            'uid': '9dc21fa757cc4eb44a0cf29d49ec3706eb24be8507c02681f9b204014c48e6c3',
             'langx': 'zh-cn',
             'ltype': '3',
             'gtype': 'FT',
@@ -54,7 +54,7 @@ class ZuqiuSpider(scrapy.Spider):
             for league in leagues:
                 lid = league.xpath('.//league_id/text()').extract_first()
                 from_data = {
-                    'uid': '9965a18b03dc6aacf12290bd5b8267fd7e38ec76eadf899b6108e82da5974cdd',
+                    'uid': '9dc21fa757cc4eb44a0cf29d49ec3706eb24be8507c02681f9b204014c48e6c3',
                     'langx': 'zh-cn',
                     'ltype': '3',
                     'gtype': 'FT',
@@ -77,7 +77,7 @@ class ZuqiuSpider(scrapy.Spider):
         if gids:
             for i, gid in enumerate(gids):
                 from_data = {
-                    'uid': '9965a18b03dc6aacf12290bd5b8267fd7e38ec76eadf899b6108e82da5974cdd',
+                    'uid': '9dc21fa757cc4eb44a0cf29d49ec3706eb24be8507c02681f9b204014c48e6c3',
                     'langx': 'zh-cn',
                     'ltype': '3',
                     'gtype': 'FT',

+ 1 - 1
hgg070_spider/utils/LocalToken.py

@@ -1 +1 @@
-token = {'token': 'JlUo1415650051585d481566c10c9', 'username': 'python', 'password': 'python888', 'token_url': 'http://admin.5gogo.com/getToken'}
+token = {'token': '2F8avN15725967815dbbec2d80aa5', 'username': 'python', 'password': 'python888', 'token_url': 'http://admin.5gogo.com/getToken'}