Browse Source

Merge branch 'master' of http://101.200.220.49:8001/houxiaohua/shop_live_scraper

chenzhiyuan 3 years ago
parent
commit
b256add46f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      dy_live_reward.py

+ 3 - 3
dy_live_reward.py

@@ -17,7 +17,7 @@ def scrape():
17 17
 
18 18
             # 如果没有待爬取的直播,则等一秒,循环
19 19
             if room_info is None:
20
-                time.sleep(1)
20
+                time.sleep(0.1)
21 21
                 continue
22 22
 
23 23
             # 判断是否到达爬取时间以确定是否需要爬取弹幕,并直接塞回队列尾部
@@ -79,7 +79,7 @@ def scrape():
79 79
                 rds.push_data_list(data)
80 80
             else:
81 81
                 print('直播ID%s %d秒前曾爬取过,暂无需继续抓取' % (room_id, time_diff))
82
-                time.sleep(1)
82
+                time.sleep(0.1)
83 83
                 rds.push_request_id(json.dumps(room_dict))
84 84
 
85 85
         except Exception as e:
@@ -95,6 +95,6 @@ if __name__ == "__main__":
95 95
 
96 96
     print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + ' 开始执行,待爬取直播队列长度:' + str(rds.get_len()))
97 97
 
98
-    for i in range(1, 50):
98
+    for i in range(1, 80):
99 99
         task = threading.Thread(target=scrape, name=i)
100 100
         task.start()  # 准备就绪,等待cpu执行