Parcourir la source

add token_sheet

wangkun il y a 2 ans
Parent
commit
9513202a4b
4 fichiers modifiés avec 34 ajouts et 11 suppressions
  1. 0 3
      logs/__init__.py
  2. 18 0
      main/demo.py
  3. 16 5
      main/weiqun_music.py
  4. 0 3
      videos/__init__.py

+ 0 - 3
logs/__init__.py

@@ -1,3 +0,0 @@
-# -*- coding: utf-8 -*-
-# @Author: wangkun
-# @Time: 2022/8/11

+ 18 - 0
main/demo.py

@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+# @Author: wangkun
+# @Time: 2022/8/12
+from main.feishu_lib import Feishu
+
+
+class Demo:
+    @classmethod
+    def demo1(cls):
+        token_sheet = Feishu.get_values_batch("weiqun", "weiqun", "WFF4jw")
+        state = token_sheet[2][1]
+        sign = token_sheet[3][1]
+        print(state)
+        print(sign)
+
+
+if __name__ == "__main__":
+    Demo.demo1()

+ 16 - 5
main/weiqun_music.py

@@ -44,10 +44,12 @@ class Music:
         # print('duration: {}'.format(duration))
         return width, height, duration
 
-    # 获取视频ID
+    # 获取视频列表
     @classmethod
     def get_video_list(cls, log_type):
         try:
+            token_sheet = Feishu.get_values_batch(log_type, "weiqun", "WFF4jw")
+            sign = token_sheet[2][3]
             # 翻10页
             for num in range(1, 5):
                 Common.logger(log_type).info("正在抓取第{}页\n", num)
@@ -69,7 +71,7 @@ class Music:
                     "c": "entry",
                     "a": "wxapp",
                     "do": "videolist",
-                    "sign": "ffccddd4e767cf98e39222026b938015",
+                    "sign": sign,
                 }
                 form = {
                     "category": "246",
@@ -135,6 +137,9 @@ class Music:
     @classmethod
     def get_video_info(cls, log_type, vid):
         try:
+            token_sheet = Feishu.get_values_batch(log_type, "weiqun", "WFF4jw")
+            state = token_sheet[2][1]
+            sign = token_sheet[3][1]
             url = "https://ayg.818ao.com/app/index.php?"
             headers = {
                 "content-type": "application/x-www-form-urlencoded",
@@ -153,8 +158,8 @@ class Music:
                 "c": "entry",
                 "a": "wxapp",
                 "do": "videodetail",
-                "state": "we7sid-da63afcc7fbfdeb15d94c9683f83dc1f",
-                "sign": "9b5c05a00fc03363daa1a48622b03bf3",
+                "state": state,
+                "sign": sign,
             }
             form = {
                 "vid": vid,
@@ -169,7 +174,13 @@ class Music:
 
                 # video_title
                 if "vtitle" in r.json()["data"]:
-                    video_title = r.json()["data"]["vtitle"]
+                    video_title = r.json()["data"]["vtitle"].strip().replace("\n", "")\
+                            .replace("/", "").replace("本山祝福", "").replace(" ", "")\
+                            .replace(" ", "").replace("&NBSP", "").replace("\r", "")\
+                            .replace("#", "").replace(".", "。").replace("\\", "")\
+                            .replace(":", "").replace("*", "").replace("?", "")\
+                            .replace("?", "").replace('"', "").replace("<", "")\
+                            .replace(">", "").replace("|", "")
                 else:
                     video_title = 0
 

+ 0 - 3
videos/__init__.py

@@ -1,3 +0,0 @@
-# -*- coding: utf-8 -*-
-# @Author: wangkun
-# @Time: 2022/8/11