Selaa lähdekoodia

kanyikan_recommend_plus.py update

crawler 1 vuosi sitten
vanhempi
commit
1fac521ff9
1 muutettua tiedostoa jossa 12 lisäystä ja 8 poistoa
  1. 12 8
      kanyikan/kanyikan_recommend/kanyikan_recommend_plus.py

+ 12 - 8
kanyikan/kanyikan_recommend/kanyikan_recommend_plus.py

@@ -40,11 +40,11 @@ class KanyikanRecommend:
             for i in range(20):
                 url = 'https://search.weixin.qq.com/cgi-bin/recwxa/recwxavideolist?'
                 vid = random.choice(
-                    ["wxv_2919617999651782659", "wxv_2850432480192151552", "wxv_3162169938824904711",
-                     "wxv_2941471556667604997", "wxv_2925481910364127233", "wxv_2704001417933733890"])
-                     # "wxv_3061881796591828994", "wxv_2893555716505255939", "wxv_2892156962760310787",
-                     # "wxv_2978003449110118403", "wxv_2896072238624571394", "wxv_2789689742178189313",
-                     # "wxv_2915541877196898305", "wxv_2922703348296826885", "wxv_2799987508020346881","wxv_2704001417933733890"])
+                    # ["wxv_2919617999651782659", "wxv_2850432480192151552", "wxv_3162169938824904711",
+                    #  "wxv_2941471556667604997", "wxv_2925481910364127233", "wxv_2704001417933733890"])
+                    ["wxv_3061881796591828994", "wxv_2893555716505255939", "wxv_2892156962760310787",
+                     "wxv_2978003449110118403", "wxv_2896072238624571394", "wxv_2789689742178189313",
+                     "wxv_2915541877196898305", "wxv_2922703348296826885", "wxv_2799987508020346881","wxv_2704001417933733890"])
                 channelid = random.choice(
                     ["200201", "200", "208", "208201"])
                 switchnewuser = random.choice(
@@ -166,9 +166,13 @@ class KanyikanRecommend:
                             Common.logger(log_type, crawler).info(f"{k}:{v}")
                         Common.logging(log_type, crawler, env, f"video_dict:{video_dict}")
                         video_percent = '%.2f' % (shared_cnt / playCount)
-                        if float(video_percent) <= 0.05:
-                            Common.logger(log_type, crawler).info(f"分享/播放<0.05:{video_percent}\n")
-                            Common.logging(log_type, crawler, env, f"分享/播放<0.05:{video_percent}\n")
+                        if float(video_percent) < 0.05:
+                            Common.logger(log_type, crawler).info(f"分享/播放:{video_percent}\n")
+                            Common.logging(log_type, crawler, env, f"分享/播放:{video_percent}\n")
+                            continue
+                        elif shared_cnt < 800:
+                            Common.logger(log_type, crawler).info(f"播放量:{playCount}\n")
+                            Common.logging(log_type, crawler, env, f"播放量:{playCount}\n")
                             continue
                         if video_dict["video_id"] == "" or video_dict["video_title"] == "" or video_dict["video_url"] == "":
                             Common.logger(log_type, crawler).info("无效视频\n")