Ver código fonte

update get feed and push time

wangkun 3 anos atrás
pai
commit
47607295a6
4 arquivos alterados com 10 adições e 5 exclusões
  1. 4 0
      main/download.py
  2. 2 2
      main/publish.py
  3. 3 3
      main/run.py
  4. 1 0
      抓取规则.txt

+ 4 - 0
main/download.py

@@ -89,6 +89,9 @@ class BSZF:
                     if "video_url" not in feeds[i]:
                         video_url = "0"
                         Common.crawler_log().info("video_url:不存在")
+                    elif ".mp4" not in feeds[i]["video_url"]:
+                        video_url = "0"
+                        Common.crawler_log().info("video_url:不存在")
                     else:
                         video_url = feeds[i]["video_url"]
                         Common.crawler_log().info("video_url:{}".format(video_url))
@@ -145,6 +148,7 @@ class BSZF:
                     video_ids = Common.read_txt("benshanzhufu_videoid.txt")
                     if video_id in [p_id.strip() for p_id in video_ids]:
                         Common.crawler_log().info("该视频已下载:{}".format(video_title))
+                        pass
                     else:
                         Common.crawler_log().info("该视频未下载:{}".format(video_title))
 

+ 2 - 2
main/publish.py

@@ -142,8 +142,8 @@ class Publish:
     video_file = 'video'
     image_file = 'image'
     info_file = 'info'
-    uids_dev_up = [6267140]
-    uids_dev_play = [6267141]
+    uids_dev_up = [6267141]
+    uids_dev_play = [6267140]
     uids_prod_up = [20631241, 20631242]
     uids_prod_play = [20631241, 20631242]
 

+ 3 - 3
main/run.py

@@ -33,13 +33,13 @@ class Main:
         """
         while True:
             prod_time = datetime.datetime.now()
-            if prod_time.hour < 9 or prod_time.hour > 12:
+            if prod_time.hour < 16 or prod_time.hour > 20:
                 Common.crawler_log().info("结束抓取视频\n")
                 time.sleep(3)
                 break
             else:
                 BSZF.get_recommend()
-                BSZF.download_video("dev")
+                BSZF.download_video("prod")
                 time.sleep(random.randint(1, 3))
 
         # 删除多余日志
@@ -52,7 +52,7 @@ class Main:
         while True:
             while True:
                 main_time = datetime.datetime.now()
-                if 12 >= main_time.hour >= 9:
+                if 20 >= main_time.hour >= 16:
                     Common.crawler_log().info("开始抓取本山祝福视频\n")
                     cls.download_job_prod()
                 else:

+ 1 - 0
抓取规则.txt

@@ -1,4 +1,5 @@
 ==========2022/4/27===========
 - 全爬
 - 每天9-12点进行爬取
+- 上传账号:20631241 / 20631242
 ==============================