zhangyong 9 miesięcy temu
rodzic
commit
29cafbfed7
1 zmienionych plików z 12 dodań i 3 usunięć
  1. 12 3
      spider/crawler_offline/xiaoniangao_zhanghao.py

+ 12 - 3
spider/crawler_offline/xiaoniangao_zhanghao.py

@@ -6,9 +6,8 @@ import subprocess
 import sys
 import time
 import uuid
-from datetime import datetime
 import requests
-
+from datetime import datetime, timedelta
 from appium import webdriver
 from appium.webdriver.extensions.android.nativekey import AndroidKey
 from appium.webdriver.common.touch_action import TouchAction
@@ -103,6 +102,15 @@ class XiaoNianGaoZH(object):
 
 
     def save_pq_uid(self, uid):
+        # 获取当前日期
+        today = datetime.now().date()
+
+        # 创建当天0点20分的时间
+        zero_twenty = datetime.combine(today, datetime.min.time()) + timedelta(minutes=20)
+
+        # 获取时间戳
+        timestamp_seconds = zero_twenty.timestamp()
+        timestamp_milliseconds = int(timestamp_seconds * 1000)
         file_path = '/Users/tzld/Desktop/automatic_crawler/spider/crawler_offline/xng_zh.txt'
         with open(file_path, 'r') as file:
             content = file.read()
@@ -112,6 +120,7 @@ class XiaoNianGaoZH(object):
             file.write(uid)
         with open(file_path, 'r') as file:
             content = file.read()
+
         url = "https://admin.piaoquantv.com/manager/crawler/v3/task/save"
         payload = {
             "taskName": "小年糕账号",
@@ -120,7 +129,7 @@ class XiaoNianGaoZH(object):
             "modeValue": "0",
             "modeBoard": "0",
             "spiderName": "run_xng_author",
-            "startTime": 1720589960000,
+            "startTime": timestamp_milliseconds,
             "interval": 4800,
             "uid": str(content),
             "machine": "aliyun",