Kaynağa Gözat

新增公众新号-调试

zhangyong 1 yıl önce
ebeveyn
işleme
63546e512e

+ 3 - 3
common/pipeline.py

@@ -164,13 +164,13 @@ class PiaoQuanPipelineTest:
         if self.platform == "gongzhonghao" or self.platform == "gongzhongxinhao":
             if (
                 int(time.time()) - publish_time_stamp
-                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1000))
+                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1))
             ) and (
                 int(time.time()) - update_time_stamp
-                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1000))
+                > 3600 * 24 * int(self.rule_dict.get("period", {}).get("max", 1))
             ):
                 message = "发布时间超过{}天".format(
-                    int(self.rule_dict.get("period", {}).get("max", 1000))
+                    int(self.rule_dict.get("period", {}).get("max", 1))
                 )
                 print(message)
                 return False

+ 11 - 5
gongzhongxinhao/gongzhongxinhao/gongzhongxinhao_author.py

@@ -223,7 +223,7 @@ class GZXHAuthor:
         article_url = article.get("url", "")
         video_id = wechat_gh + str(int(date_time_obj.timestamp()))
         cover_url = article.get("head_pic", "")
-        video_url = self.get_video_url(article_url)
+        # video_url = self.get_video_url(article_url)
         video_dict = {
             "user_name": user_name,
             "video_id": video_id,
@@ -241,7 +241,7 @@ class GZXHAuthor:
             "share_cnt": 0,
             "user_id": self.user_dict["uid"],
             "cover_url": cover_url,
-            "video_url": video_url,
+            "video_url": article_url,
             "width": 0,
             "height": 0,
             "duration": 0,
@@ -261,7 +261,7 @@ class GZXHAuthor:
             data=video_dict,
         )
         pipeline = PiaoQuanPipeline(
-            platform=self.platform,
+            platform='gongzhonghao',
             mode=self.mode,
             item=video_dict,
             rule_dict=self.rule_dict,
@@ -270,6 +270,12 @@ class GZXHAuthor:
         )
         if not pipeline.repeat_video():
             return True
+        if not pipeline.download_rule_flag():
+            return True
+        if not pipeline.title_flag():
+            return True
+        if not pipeline.publish_time_flag():
+            return True
         else:
             current_time = datetime.now()
             timestamp = current_time.strftime("%Y-%m-%d %H:%M:%S")
@@ -308,10 +314,10 @@ class GZXHAuthor:
 if __name__ == "__main__":
     GZ = GZXHAuthor(
 
-        platform="gongzhongxinhao",
+        platform="gongzhonghao",
         mode="author",
         user_dict={"uid": "123456", "link": "https://mp.weixin.qq.com/s/Cwc2D3RUNDk30zv_s0IxTA", "user_id": "1234565"},
-        rule_dict={},
+        rule_dict={"rule": "{period:{min:1,max:1}}"},
         env="dev",
     )