Browse Source

修改角球赛事赔率

Your Name 6 years ago
parent
commit
1ae19628a2
3 changed files with 8 additions and 7 deletions
  1. 2 2
      hg3535/main.py
  2. 4 3
      hg3535/pipeline/zhibo.py
  3. 2 2
      hg3535/spiders/zhibo.py

+ 2 - 2
hg3535/main.py

@@ -18,6 +18,6 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
 # execute(["scrapy", "crawl", "ball_status"]) #滚球id本地存
 # execute(["scrapy", "crawl", "ball_status"]) #滚球id本地存
 # execute(["scrapy", "crawl", "ball_status_update"]) #滚球id结束时间更新状态
 # execute(["scrapy", "crawl", "ball_status_update"]) #滚球id结束时间更新状态
 # execute(["scrapy", "crawl", "saiguo"]) #滚球id结束时间更新状态
 # execute(["scrapy", "crawl", "saiguo"]) #滚球id结束时间更新状态
-execute(["scrapy", "crawl", "jieshu"]) #滚球id结束时间更新状态
-# execute(["scrapy", "crawl", "zhibo"]) #滚球id结束时间更新状态
+# execute(["scrapy", "crawl", "jieshu"]) #滚球id结束时间更新状态
+execute(["scrapy", "crawl", "zhibo"]) #滚球id结束时间更新状态
 # execute(["scrapy", "crawl", "bq_jieshu"]) #滚球id结束时间更新状态
 # execute(["scrapy", "crawl", "bq_jieshu"]) #滚球id结束时间更新状态

+ 4 - 3
hg3535/pipeline/zhibo.py

@@ -14,9 +14,9 @@ from ..settings import M_HOST, M_USER, M_PASSWORD, M_POST, M_DB, MATCHWARN
 class Zuqiupipeline(object):
 class Zuqiupipeline(object):
 
 
     def open_spider(self, spider):
     def open_spider(self, spider):
-        pass
-        # self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
-        # self.db = self.mongo[M_DB]
+        # pass
+        self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
+        self.db = self.mongo[M_DB]
 
 
     @defer.inlineCallbacks
     @defer.inlineCallbacks
     def process_item(self, item, spider):
     def process_item(self, item, spider):
@@ -42,6 +42,7 @@ class Zuqiupipeline(object):
             res = Helper.async_post(MATCHWARN, warn_dict)
             res = Helper.async_post(MATCHWARN, warn_dict)
             if res.get('status') == 1:
             if res.get('status') == 1:
                 print('危险球提交成功')
                 print('危险球提交成功')
+                self.db.FT_warn35.insert(warn_dict)
                 logger.info('足球直播危险球提交成功, {}'.format(res))
                 logger.info('足球直播危险球提交成功, {}'.format(res))
             else:
             else:
                 logger.warning('足球直播危险球提交成功,提交失败, {}'.format(res))
                 logger.warning('足球直播危险球提交成功,提交失败, {}'.format(res))

+ 2 - 2
hg3535/spiders/zhibo.py

@@ -4,7 +4,7 @@ import datetime
 import json
 import json
 
 
 # import jsonpath
 # import jsonpath
-import time
+# import time
 
 
 import redis
 import redis
 import scrapy
 import scrapy
@@ -78,7 +78,7 @@ class ZuqiuSpider(scrapy.Spider):
                         print('有卡牌, 事件')
                         print('有卡牌, 事件')
                         event_team = match_event['team']
                         event_team = match_event['team']
                         team_name = match_dict[event_team]['name']
                         team_name = match_dict[event_team]['name']
-                        # # 事件分钟
+                        # 事件分钟
                         # event_time = match_event['time']
                         # event_time = match_event['time']
                         event_name = match_event['name']
                         event_name = match_event['name']
                         event_uts = match_event['uts']
                         event_uts = match_event['uts']