瀏覽代碼

品类指定健康

zhangyong 9 月之前
父節點
當前提交
d76467f32b
共有 2 個文件被更改,包括 59 次插入57 次删除
  1. 56 56
      channel_ks/ks_feed_list.py
  2. 3 1
      main.py

+ 56 - 56
channel_ks/ks_feed_list.py

@@ -18,33 +18,33 @@ headers = {
 }
 class KsFeedVideo:
     CATEGORY_IDS = {
-        1: "生活",
-        2: "才艺",
-        3: "时尚",
-        4: "宠物",
-        5: "读书",
-        6: "二次元",
-        7: "家居",
-        8: "数码",
-        9: "搞笑",
+        # 1: "生活",
+        # 2: "才艺",
+        # 3: "时尚",
+        # 4: "宠物",
+        # 5: "读书",
+        # 6: "二次元",
+        # 7: "家居",
+        # 8: "数码",
+        # 9: "搞笑",
         10: "健康",
-        11: "旅游",
-        12: "美食",
-        13: "美妆",
-        14: "汽车",
-        15: "亲子",
-        16: "情感",
-        17: "三农",
-        18: "摄影",
-        19: "舞蹈",
-        20: "颜值",
-        21: "音乐",
-        22: "影视",
-        23: "短剧",
-        24: "游戏",
-        25: "运动",
-        26: "资讯",
-        27: "人文"
+        # 11: "旅游",
+        # 12: "美食",
+        # 13: "美妆",
+        # 14: "汽车",
+        # 15: "亲子",
+        # 16: "情感",
+        # 17: "三农",
+        # 18: "摄影",
+        # 19: "舞蹈",
+        # 20: "颜值",
+        # 21: "音乐",
+        # 22: "影视",
+        # 23: "短剧",
+        # 24: "游戏",
+        # 25: "运动",
+        # 26: "资讯",
+        # 27: "人文"
     }
     current_category_index = 0
 
@@ -157,33 +157,33 @@ class KsFeedVideo:
     @classmethod
     def get_id_by_category(cls, category_name):
         category_list = [
-            {"id": 71502003, "category": "生活"},
-            {"id": 71502004, "category": "才艺"},
-            {"id": 71502005, "category": "时尚"},
-            {"id": 71502006, "category": "宠物"},
-            {"id": 71502007, "category": "读书"},
-            {"id": 71502008, "category": "二次元"},
-            {"id": 71502009, "category": "家居"},
-            {"id": 71502010, "category": "数码"},
-            {"id": 71502011, "category": "搞笑"},
+            # {"id": 71502003, "category": "生活"},
+            # {"id": 71502004, "category": "才艺"},
+            # {"id": 71502005, "category": "时尚"},
+            # {"id": 71502006, "category": "宠物"},
+            # {"id": 71502007, "category": "读书"},
+            # {"id": 71502008, "category": "二次元"},
+            # {"id": 71502009, "category": "家居"},
+            # {"id": 71502010, "category": "数码"},
+            # {"id": 71502011, "category": "搞笑"},
             {"id": 71502012, "category": "健康"},
-            {"id": 71502013, "category": "旅游"},
-            {"id": 71502014, "category": "美食"},
-            {"id": 71502015, "category": "美妆"},
-            {"id": 71502016, "category": "汽车"},
-            {"id": 71502018, "category": "亲子"},
-            {"id": 71502019, "category": "情感"},
-            {"id": 71502020, "category": "三农"},
-            {"id": 71502021, "category": "摄影"},
-            {"id": 71502022, "category": "舞蹈"},
-            {"id": 71502023, "category": "颜值"},
-            {"id": 71502024, "category": "音乐"},
-            {"id": 71502025, "category": "影视"},
-            {"id": 71502026, "category": "短剧"},
-            {"id": 71502027, "category": "游戏"},
-            {"id": 71502028, "category": "运动"},
-            {"id": 71502029, "category": "资讯"},
-            {"id": 71502030, "category": "人文"}
+            # {"id": 71502013, "category": "旅游"},
+            # {"id": 71502014, "category": "美食"},
+            # {"id": 71502015, "category": "美妆"},
+            # {"id": 71502016, "category": "汽车"},
+            # {"id": 71502018, "category": "亲子"},
+            # {"id": 71502019, "category": "情感"},
+            # {"id": 71502020, "category": "三农"},
+            # {"id": 71502021, "category": "摄影"},
+            # {"id": 71502022, "category": "舞蹈"},
+            # {"id": 71502023, "category": "颜值"},
+            # {"id": 71502024, "category": "音乐"},
+            # {"id": 71502025, "category": "影视"},
+            # {"id": 71502026, "category": "短剧"},
+            # {"id": 71502027, "category": "游戏"},
+            # {"id": 71502028, "category": "运动"},
+            # {"id": 71502029, "category": "资讯"},
+            # {"id": 71502030, "category": "人文"}
         ]
         for category in category_list:
             if category['category'] == category_name:
@@ -262,7 +262,7 @@ class KsFeedVideo:
                     if time_status:
                         sqlCollect.insert_ks_data(user_name, user_sex, time_data, caption, view_count, like_count, share_count, duration, main_mv_url, thumbnail_url, user_id, '1', photo_id, category_name, age=None, oss_object=None, video_uid=None)
                         continue
-                    video_percent = '%.2f' % (share_count / like_count)
+                    video_percent = '%.2f' % (share_count / view_count)
                     special = float(0.1)
                     if float(video_percent) < special or share_count < 500 or duration < 10 or duration > 600:
                         sqlCollect.insert_ks_data(user_name, user_sex, time_data, caption, view_count, like_count, share_count, duration, main_mv_url, thumbnail_url, user_id, '1', photo_id, category_name, age=None, oss_object=None, video_uid=None)
@@ -286,11 +286,11 @@ class KsFeedVideo:
                         current_time = datetime.now()
                         formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
                         values = [
-                            [category_name, user_name, user_sex, caption, view_count, like_count, share_count, duration,
+                            [category_name, user_name, photo_id, user_sex, caption, view_count, like_count, share_count, duration,
                              main_mv_url, thumbnail_url, user_id, age, pq_id, "video_uid", time_data, formatted_time]]
-                        Feishu.insert_columns("PlcisKhObhzmBothRutc65sJnph", "823f74", "ROWS", 1, 2)
+                        Feishu.insert_columns("PlcisKhObhzmBothRutc65sJnph", "8fQxFv", "ROWS", 1, 2)
                         time.sleep(0.5)
-                        Feishu.update_values("PlcisKhObhzmBothRutc65sJnph", "823f74", "A2:Z2", values)
+                        Feishu.update_values("PlcisKhObhzmBothRutc65sJnph", "8fQxFv", "A2:Z2", values)
                 time.sleep(80)
             except Exception as exc:
                 print(f"异常信息: {exc}")

+ 3 - 1
main.py

@@ -13,7 +13,9 @@ def video_start():
     print(f"执行结束:{formatted_time}")
 
 
-schedule.every(1).hours.do(video_start)
+# schedule.every(1).hours.do(video_start)
+schedule.every(10).minutes.do(video_start)
+
 KsFeedVideo.get_data()
 
 while True: