瀏覽代碼

增加春节素材

zhangyong 1 年之前
父節點
當前提交
ef516c6f14
共有 6 個文件被更改,包括 81 次插入14 次删除
  1. 17 0
      common/material.py
  2. 12 0
      common/sql_help.py
  3. 24 0
      douyin_main.py
  4. 24 0
      kuaishou_main.py
  5. 3 13
      main.py
  6. 1 1
      video_capture/kuaishou/kuaishou_author/kuaishou_author.py

+ 17 - 0
common/material.py

@@ -53,6 +53,23 @@ class Material():
                     machine="",
                 )
 
+    # 获取快手视频链接 存入数据库
+    @classmethod
+    def insert_kuaishou_chunjie_user(cls):
+        # 获取快手视频链接
+        kuaishou = Feishu.get_values_batch("prod", "succinct", "7EB9WK")
+        # 提取账号昵称和账号主页链接
+        channel = '快手-春节'
+        for row in kuaishou[2:]:
+            account_link = row[1]
+            user_id = account_link.split("profile/")[1]
+            insert_sql = f"""INSERT INTO video_user_id (user_id, channel) values ('{user_id}', '{channel}')"""
+            MysqlHelper.update_values(
+                sql=insert_sql,
+                env="prod",
+                machine="",
+            )
+
     # 随机获取标题
     @classmethod
     def get_title(cls):

+ 12 - 0
common/sql_help.py

@@ -58,3 +58,15 @@ class sql():
             count = 0
         count = str(count).replace('(', '').replace(')', '').replace(',', '')
         return int(count)
+
+    #  获取春节自制-节日数量
+    @classmethod
+    def get_chunjie_zizhi_account_id(cls):
+        current_time = datetime.now()
+        formatted_time = current_time.strftime("%Y-%m-%d")
+        count = f"""SELECT COUNT(*) AS total_count FROM ( SELECT audio, account_id FROM video_audio WHERE time = '{formatted_time}' AND video_type = 4 GROUP BY audio, account_id) AS subquery;"""
+        count = MysqlHelper.get_values(count, "prod")
+        if count == None:
+            count = 0
+        count = str(count).replace('(', '').replace(')', '').replace(',', '')
+        return int(count)

+ 24 - 0
douyin_main.py

@@ -0,0 +1,24 @@
+import os
+import sys
+
+import schedule
+import time
+sys.path.append(os.getcwd())
+from video_capture.kuaishou.kuaishou_author.kuaishou_author import kuaishouAuthor
+from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
+
+
+def job_douyin_data():
+    douyinAuthor.get_videoList()
+
+# 每10个小时执行一次
+schedule.every(4).hours.do(job_douyin_data)
+
+
+
+
+
+while True:
+    schedule.run_pending()
+    time.sleep(1)
+

+ 24 - 0
kuaishou_main.py

@@ -0,0 +1,24 @@
+import os
+import sys
+
+import schedule
+import time
+sys.path.append(os.getcwd())
+from video_capture.kuaishou.kuaishou_author.kuaishou_author import kuaishouAuthor
+from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
+
+
+
+
+def job_kuaishou_data():
+    kuaishouAuthor.get_kuaishou_videoList()
+
+# 每10个小时执行一次
+schedule.every(4).hours.do(job_kuaishou_data)
+
+
+
+while True:
+    schedule.run_pending()
+    time.sleep(1)
+

+ 3 - 13
main.py

@@ -19,9 +19,10 @@ def job_video_stitching():
     dy_yinmei_count = sql.get_dy_yinmei_account_id()
     koubo_count = sql.get_koubo_account_id()
     jieri_count = sql.get_jieri_account_id()
+    chunjie_zizhi_count = sql.get_chunjie_zizhi_account_id()
     ks_yinmei_count = sql.get_ks_yinmei_account_id()
-    # if int(jieri_count) < 20:
-    #     Common.logger("video").info("开始执行-口播-小年")
+    # elif int(jieri_count) < 10:
+    #     Common.logger("video").info("开始执行-口播-春节")
     #     video_type = "口播--美文类"
     #     channel_type = "jieri"
     #     VideoStitching.video_stitching(video_type, koubo_count, channel_type)
@@ -58,17 +59,6 @@ def job_feishu_bot():
     if count < 30:
         Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n口播视频拼接:{koubo_count}条')
 
-def job_douyin_data():
-    douyinAuthor.get_videoList()
-
-def job_kuaishou_data():
-    kuaishouAuthor.get_kuaishou_videoList()
-
-# 每10个小时执行一次
-schedule.every(10).hours.do(job_douyin_data)
-
-# 每10个小时执行一次
-schedule.every(10).hours.do(job_kuaishou_data)
 
 # 每15分钟执行一次
 schedule.every(15).minutes.do(job_video_stitching)

+ 1 - 1
video_capture/kuaishou/kuaishou_author/kuaishou_author.py

@@ -39,7 +39,7 @@ class kuaishouAuthor():
     """
     @classmethod
     def get_kuaishou_videoUserId(cls):
-        select_user_sql = f"""select user_id from video_user_id where channel = "快手";"""
+        select_user_sql = f"""select user_id from video_user_id where channel LIKE '%快手%' ORDER BY id DESC;"""
         user_list = MysqlHelper.get_values(select_user_sql, "prod")
         return user_list