zhangyong 2 maanden geleden
bovenliggende
commit
28d0e2ce2b
2 gewijzigde bestanden met toevoegingen van 23 en 23 verwijderingen
  1. 1 1
      spider/crawler_online/laonianquan.py
  2. 22 22
      spider/crawler_online/laonianshenghuokuaile.py

+ 1 - 1
spider/crawler_online/laonianquan.py

@@ -167,7 +167,7 @@ class LNQRecommend(object):
             'Content-Type': 'application/json'
             'Content-Type': 'application/json'
         }
         }
         try:
         try:
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=10)
             response = response.json()
             response = response.json()
             if response['code'] != 0:
             if response['code'] != 0:
                 self.aliyun_log.logging(
                 self.aliyun_log.logging(

+ 22 - 22
spider/crawler_online/laonianshenghuokuaile.py

@@ -126,27 +126,27 @@ class LNSHKLRecommend(object):
             trace_id=trace_id,
             trace_id=trace_id,
         )
         )
         if pipeline.process_item():
         if pipeline.process_item():
-            title_list = title_rule.split(",")
-            title = video_obj["title"]
-            contains_keyword = any(keyword in title for keyword in title_list)
-            if contains_keyword:
-                new_title = GPT4oMini.get_ai_mini_title(title)
-                if new_title:
-                    item.add_video_info("video_title", new_title)
-                    current_time = datetime.now()
-                    formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
-                    values = [
-                        [
-                            video_url,
-                            video_obj["cover"],
-                            title,
-                            new_title,
-                            formatted_time,
-                        ]
-                    ]
-                    FeishuUtils.insert_columns("U5dXsSlPOhiNNCtEfgqcm1iYnpf", "8c7191", "ROWS", 1, 2)
-                    time.sleep(0.5)
-                    FeishuUtils.update_values("U5dXsSlPOhiNNCtEfgqcm1iYnpf", "8c7191", "A2:Z2", values)
+            # title_list = title_rule.split(",")
+            # title = video_obj["title"]
+            # contains_keyword = any(keyword in title for keyword in title_list)
+            # if contains_keyword:
+            #     new_title = GPT4oMini.get_ai_mini_title(title)
+            #     if new_title:
+            #         item.add_video_info("video_title", new_title)
+            #         current_time = datetime.now()
+            #         formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
+            #         values = [
+            #             [
+            #                 video_url,
+            #                 video_obj["cover"],
+            #                 title,
+            #                 new_title,
+            #                 formatted_time,
+            #             ]
+            #         ]
+            #         FeishuUtils.insert_columns("U5dXsSlPOhiNNCtEfgqcm1iYnpf", "8c7191", "ROWS", 1, 2)
+            #         time.sleep(0.5)
+            #         FeishuUtils.update_values("U5dXsSlPOhiNNCtEfgqcm1iYnpf", "8c7191", "A2:Z2", values)
             self.download_cnt += 1
             self.download_cnt += 1
             self.mq.send_msg(mq_obj)
             self.mq.send_msg(mq_obj)
             self.aliyun_log.logging(code="1002", message="成功发送至 ETL", data=mq_obj)
             self.aliyun_log.logging(code="1002", message="成功发送至 ETL", data=mq_obj)
@@ -167,7 +167,7 @@ class LNSHKLRecommend(object):
             'Content-Type': 'application/json'
             'Content-Type': 'application/json'
         }
         }
         try:
         try:
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=10)
             response = response.json()
             response = response.json()
             if response['code'] != 0:
             if response['code'] != 0:
                 self.aliyun_log.logging(
                 self.aliyun_log.logging(