Explorar o código

西瓜新老视频兼容性

罗俊辉 hai 1 ano
pai
achega
6a8ddec07d
Modificáronse 2 ficheiros con 10 adicións e 18 borrados
  1. 2 16
      test.py
  2. 8 2
      xigua/xigua_author/xigua_author.py

+ 2 - 16
test.py

@@ -1,16 +1,2 @@
-import os
-
-f = open("crontab.txt", "a+")
-
-for parent, dirs, files in os.walk("./"):
-    if files and "main" in parent:
-        for file in files:
-            if file.startswith("run") and "dev" not in file:
-                file_p = os.path.join(parent, file)
-                proj = file_p.split("/")[1]
-                s = file_p.split("run_")[1].split("_")[0]
-                method = file_p.split("_")[-1][:-3]
-                if method in ["recommend", "hour", "author", "play"]:
-                    line = '* * * * * /usr/bin/sh /root/piaoquan_crawler/main/process_mq.sh "{}" "{}" "{}" "prod"'.format(s, proj, method)
-                    print(line)
-                    f.write(line + "\n")
+w = "V1_https://www.ixigua.com/home/4078811612/?source=pgc_author_name&list_entrance=anyVideo"
+print(w[3:])

+ 8 - 2
xigua/xigua_author/xigua_author.py

@@ -680,7 +680,10 @@ class XiGuaAuthor:
             return self.rule_dict
 
     def get_author_list(self):
-        # 每轮只抓取定量的数据,到达数量后自己退出
+        """
+        每轮只抓取定量的数据,到达数量后自己退出
+        获取账号列表以及账号信息
+        """
         # max_count = int(self.rule_dict.get("videos_cnt", {}).get("min", 300))
         for user_dict in self.user_list:
             # if self.download_count <= max_count:
@@ -707,12 +710,15 @@ class XiGuaAuthor:
             #     return
 
     def get_video_list(self, user_dict):
+        """
+        获取某个账号的视频列表
+        """
         offset = 0
         signature = random_signature()
         url = "https://www.ixigua.com/api/videov2/author/new_video_list?"
         while True:
             if user_dict['link'][0] == "V":
-                link = user_dict["link"][2:]
+                link = user_dict["link"][3:]
             else:
                 link = user_dict["link"]
             to_user_id = str(link.replace("https://www.ixigua.com/home/", ""))