zhangyong преди 8 месеца
родител
ревизия
1dc95e05cd
променени са 2 файла, в които са добавени 12 реда и са изтрити 8 реда
  1. 1 1
      sph_sy_main.py
  2. 11 7
      xssy_channel/sph_nrxs.py

+ 1 - 1
sph_sy_main.py

@@ -16,7 +16,7 @@ def video_start_sph():
 
 # 每天早上 10:30 执行
 schedule.every().day.at("10:30").do(video_start_sph)
-SphNrxs.sph_nrxs_data()
+# SphNrxs.sph_nrxs_data()
 while True:
     schedule.run_pending()
     time.sleep(1)

+ 11 - 7
xssy_channel/sph_nrxs.py

@@ -245,21 +245,25 @@ class SphNrxs:
             time.sleep(2)
             response = requests.request("POST", url, headers=headers, data=payload)
             response = response.json()
+            if response['data'] == None:
+                sqlCollect.update_machine_making_reflux(uid)
+                return
             code = response['code']
             if code == 0:
+                status = sqlCollect.select_crawler_uesr_v3(uid)
+                if status:
+                    pq_id = re.sub(r'[(),]', '', str(status))
+                else:
+                    pq_id = cls.insert_number(uid)
+                    if pq_id == None:
+                        return
                 sqlCollect.update_machine_making_reflux(uid)
                 data_list = response['data']['data']
                 if data_list:
                     for data in data_list:
                         nick_name = data['nickName']  # 用户名
                         user_name = data['username']  # 用户v2
-                        status = sqlCollect.select_crawler_uesr_v3(uid)
-                        if status:
-                            pq_id = re.sub(r'[(),]', '', str(status))
-                        else:
-                            pq_id = cls.insert_number(nick_name)
-                            if pq_id == None:
-                                continue
+
                         user = cls.get_sph_data(user_name, uid)
                         if user:
                             # time.sleep(180)