Bläddra i källkod

线下 代码优化

piaoquan 1 år sedan
förälder
incheckning
2b7ff4f561

+ 4 - 1
jixiangxingfu/jixiangxingfu_recommend/jixiangxingfu_recommend.py

@@ -126,7 +126,10 @@ class JixiangxingfuRecommend:
                             env=env,
                             message="发现并关闭系统下拉菜单栏"
                         )
-                        driver.find_element(By.ID, 'com.android.systemui:id/dismiss_view').click()
+                        size = driver.get_window_size()
+                        driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                          int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
+                        # driver.find_element(By.ID, 'com.android.systemui:id/dismiss_view').click()
                     else:
                         pass
                 except NoSuchElementException:

+ 1 - 0
main/process_offline.sh

@@ -77,6 +77,7 @@ fi
 # 漂漂圈
 if [[ "$time" > "04:00:00"  &&  "$time" < "06:59:59" ]];then
   echo "$(date "+%Y-%m-%d %H:%M:%S") 开始启动 漂漂圈 爬虫脚本任务" >> ${log_path}
+  ps aux | grep run_ppqsift | grep -v grep | awk '{print $2}' | xargs kill -9
   ps aux | grep run_xngplus | grep -v grep | awk '{print $2}' | xargs kill -9
   ps aux | grep run_xngrule | grep -v grep | awk '{print $2}' | xargs kill -9
   ps aux | grep run_jixiangxingfu | grep -v grep | awk '{print $2}' | xargs kill -9

+ 3 - 1
piaopiaoquan/piaopiaoquan/piaopiaoquan_recommend.py

@@ -108,7 +108,9 @@ class PPQRecommend:
                         env=self.env,
                         message="发现并关闭系统下拉菜单"
                     )
-                    self.driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
+                    size = self.driver.get_window_size()
+                    self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                      int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
                 else:
                     pass
             except NoSuchElementException:

+ 15 - 2
piaopiaoquan/piaopiaoquan/piaopiaoquan_sift.py

@@ -40,9 +40,9 @@ class PPQSiftRecommend:
         self.rule_dict = rule_dict
         self.our_uid = our_uid
         if self.env == "dev":
-            chromedriverExecutable = "/Users/tzld/Downloads/chromedriver_v111/chromedriver"
+            chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver"
         else:
-            chromedriverExecutable = "/Users/tzld/Downloads/chromedriver_v111/chromedriver"
+            chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver"
 
         Common.logger(self.log_type, self.crawler).info("启动微信")
         # 微信的配置文件
@@ -92,6 +92,19 @@ class PPQSiftRecommend:
                         message="启动微信成功"
                     )
                     break
+                elif self.driver.find_element(By.ID, "com.android.systemui:id/dismiss_view"):
+                    Common.logger(self.log_type, self.crawler).info("发现并关闭系统下拉菜单")
+                    # Common.logging(self.log_type, self.crawler, self.env, '发现并关闭系统下拉菜单')
+                    AliyunLogger.logging(
+                        code="1000",
+                        platform=self.platform,
+                        mode=self.log_type,
+                        env=self.env,
+                        message="发现并关闭系统下拉菜单"
+                    )
+                    size = self.driver.get_window_size()
+                    self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                      int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
                 else:
                     pass
             except NoSuchElementException:

+ 4 - 1
xiaoniangaoplus/xiaoniangaoplus/xiaoniangao_plus_get_userid.py

@@ -84,7 +84,9 @@ class XiaoNianGaoPlusRecommend:
                     break
                 elif self.driver.find_element(By.ID, "com.android.systemui:id/dismiss_view"):
                     Common.logger(self.log_type, self.crawler).info("发现并关闭系统下拉菜单")
-                    self.driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
+                    size = self.driver.get_window_size()
+                    self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                 int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
                 else:
                     pass
             except NoSuchElementException:
@@ -162,6 +164,7 @@ class XiaoNianGaoPlusRecommend:
         soup = BeautifulSoup(page_source, 'html.parser')
         soup.prettify()
         video_list = soup.findAll(name="wx-view", attrs={"class": "expose--adapt-parent"})
+        index = index + 1
         element_list = [i for i in video_list][index:]
         return element_list[0]
 

+ 5 - 1
xiaoniangaoplus/xiaoniangaoplus/xiaoniangao_plus_scheduling2.py

@@ -116,7 +116,10 @@ class XiaoNianGaoPlusRecommend:
                         env=self.env,
                         message="发现并关闭系统下拉菜单"
                     )
-                    self.driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
+                    size = self.driver.get_window_size()
+                    self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                      int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
+                #     self.driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
                 else:
                     pass
             except Exception as e:
@@ -221,6 +224,7 @@ class XiaoNianGaoPlusRecommend:
         soup = BeautifulSoup(page_source, 'html.parser')
         soup.prettify()
         video_list = soup.findAll(name="wx-view", attrs={"class": "expose--adapt-parent"})
+        index = index + 1
         element_list = [i for i in video_list][index:]
         return element_list[0]
 

+ 11 - 0
zhongmiaoyinxin/zhongmiaoyinxin_recommend/zhongmiaoyinxin_recommend_new.py

@@ -95,6 +95,17 @@ class ZMYXRecommend:
             self.get_videoList()
             time.sleep(100)
             self.driver.quit()
+        elif self.driver.find_element(By.ID, "com.android.systemui:id/dismiss_view"):
+            AliyunLogger.logging(
+                code="1000",
+                platform=self.platform,
+                mode=self.log_type,
+                env=self.env,
+                message="发现并关闭系统下拉菜单"
+            )
+            size = self.driver.get_window_size()
+            self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                              int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
         else:
             AliyunLogger.logging(
                 code="3001",

+ 5 - 1
zhufuquanzi/zhufuquanzi_recommend/zhufuquanzi_recommend_new.py

@@ -93,7 +93,11 @@ class ZFQZRecommend:
                         env=env,
                         message="发现并关闭系统下拉菜单"
                     )
-                    driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
+                    size = driver.get_window_size()
+                    driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.8),
+                                 int(size['width'] * 0.5), int(size['height'] * 0.2), 200)
+
+                #     driver.find_element(By.ID, "com.android.system:id/dismiss_view").click()
                 else:
                     pass
             except NoSuchElementException: