3
0
chenjunhao 3 nedēļas atpakaļ
vecāks
revīzija
acb9715a3b

+ 5 - 5
spiders/yaojiujiu/yyjzt_crawl.py

@@ -86,7 +86,7 @@ class YyjztSpider:
         self.product_brand = self.task_dict.get("product_brand", "")
         self.keyword = (
             self.task_dict.get("product_keyword", "")
-            or (self.task_dict.get("product_brand", "") + " " + self.product_name + " " + self.product_specs).strip()
+            or (self.task_dict.get("product_brand", "").strip() + " " + self.product_name.strip() + " " + self.product_specs.strip()).strip()
         ).strip()
         self.sampling_cycle = self.task_dict.get("sampling_cycle", "")
         self.sampling_start_time = self.task_dict.get("sampling_start_time", "")
@@ -372,10 +372,10 @@ class YyjztSpider:
 
         brand_ok = True
         name_ok = True
-        if self.product_brand:
-            brand_ok = self.product_brand in str(product_brand)
-        if self.product_name:
-            name_ok = self.product_name in str(product_name)
+        if self.product_brand.strip():
+            brand_ok = self.product_brand.strip() in str(product_brand)
+        if self.product_name.strip():
+            name_ok = self.product_name.strip() in str(product_name)
         return brand_ok and name_ok
 
     def search_data(self):

+ 1 - 1
spiders/yaojiujiu/yyjzt_snapshot.py

@@ -65,7 +65,7 @@ class YyjztSnapshotSpider:
         self.product_brand = self.task_dict.get("product_brand", "")
         self.keyword = (
             self.task_dict.get("product_keyword", "")
-            or (self.task_dict.get("product_brand", "") + " " + self.product_name + " " + self.product_specs).strip()
+            or (self.task_dict.get("product_brand", "").strip() + " " + self.product_name.strip() + " " + self.product_specs.strip()).strip()
         ).strip()
         self.collect_task_id = self.task_dict.get("collect_task_id", "")
         self.collect_round = self.task_dict.get("collect_round", "1")

+ 1 - 1
start_run_yaojiujiu.py

@@ -106,7 +106,7 @@ def run_one_task(scheduler, device_id, account_password, account_name):
 
     # 根据 snapshot_collect_status 决定走普通爬虫还是快照爬虫
     snapshot_status = task_dict.get("snapshot_collect_status", 0)
-    if snapshot_status == 0:
+    if not snapshot_status:
         spider_cls = YyjztSnapshotSpider
         logger.info("任务 %s 启用快照模式", task_id)
     else: