wangkun 2 سال پیش
والد
کامیت
76aed23937
2فایلهای تغییر یافته به همراه19 افزوده شده و 8 حذف شده
  1. 11 0
      shipinhao.sh
  2. 8 8
      shipinhao/shipinhao_follow.py

+ 11 - 0
shipinhao.sh

@@ -12,6 +12,17 @@ echo "$(date "+%Y-%m-%d %H:%M:%S") 正在更新代码..."
 cd /Users/lieyunye/Desktop/crawler/crawler_shipinhao/ && git pull origin master --force && rm -f nohup.log
 echo "$(date "+%Y-%m-%d %H:%M:%S") 代码更新完成!"
 
+echo "$(date "+%Y-%m-%d %H:%M:%S") 正在重启Appium..."
+# shellcheck disable=SC2009
+ps aux | grep Appium.app | grep -v grep | awk '{print $2}' | xargs kill -9
+nohup /usr/local/bin/node /Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js >>./nohup.log 2>&1 &
+echo "$(date "+%Y-%m-%d %H:%M:%S") 重启Appium完毕!"
+
+echo "$(date "+%Y-%m-%d %H:%M:%S") 正在重启adb..."
+adb kill-server
+adb start-server
+echo "$(date "+%Y-%m-%d %H:%M:%S") 重启adb完毕!"
+
 echo "$(date "+%Y-%m-%d %H:%M:%S") 正在重启服务..."
 #nohup python3 -u main/run_shipinhao_recommend.py >>./nohup.log 2>&1 &
 nohup python3 -u main/run_shipinhao_follow.py >>./nohup.log 2>&1 &

+ 8 - 8
shipinhao/shipinhao_follow.py

@@ -428,16 +428,16 @@ class Follow:
 
     @classmethod
     def search_to_all_user_homepage(cls, log_type, env):
-        # try:
-        user_list = cls.get_users_from_feishu(log_type)
-        for user in user_list:
-            cls.start_follow_wechat(log_type, user, env)
-        Common.logger(log_type).info('所有用户已抓取完毕\n')
-        # except Exception as e:
-        #     Common.logger(log_type).error(f'search_to_all_user_homepage异常:{e}\n')
+        try:
+            user_list = cls.get_users_from_feishu(log_type)
+            for user in user_list:
+                cls.start_follow_wechat(log_type, user, env)
+            Common.logger(log_type).info('所有用户已抓取完毕\n')
+        except Exception as e:
+            Common.logger(log_type).error(f'search_to_all_user_homepage异常:{e}\n')
 
 
 if __name__ == '__main__':
-    print(Follow.filter_words('follow'))
+    print(Follow.get_users_from_feishu('follow'))
     pass