|
@@ -4,6 +4,8 @@
|
|
import json
|
|
import json
|
|
import os
|
|
import os
|
|
import random
|
|
import random
|
|
|
|
+import subprocess
|
|
|
|
+
|
|
import sys
|
|
import sys
|
|
import time
|
|
import time
|
|
import uuid
|
|
import uuid
|
|
@@ -54,7 +56,7 @@ class XiaoNianGaoPlusRecommend:
|
|
if self.env == "dev":
|
|
if self.env == "dev":
|
|
chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver"
|
|
chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver"
|
|
else:
|
|
else:
|
|
- chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver"
|
|
|
|
|
|
+ chromedriverExecutable = "/Users/piaoquan/Downloads/chromedriver-mac-x64/chromedriver"
|
|
|
|
|
|
Common.logger(self.log_type, self.crawler).info("启动微信")
|
|
Common.logger(self.log_type, self.crawler).info("启动微信")
|
|
# Common.logging(self.log_type, self.crawler, self.env, '启动微信')
|
|
# Common.logging(self.log_type, self.crawler, self.env, '启动微信')
|
|
@@ -136,8 +138,11 @@ class XiaoNianGaoPlusRecommend:
|
|
Common.logger(self.log_type, self.crawler).info("下滑,展示小程序选择面板")
|
|
Common.logger(self.log_type, self.crawler).info("下滑,展示小程序选择面板")
|
|
size = self.driver.get_window_size()
|
|
size = self.driver.get_window_size()
|
|
self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.2),
|
|
self.driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.2),
|
|
- int(size['width'] * 0.5), int(size['height'] * 0.8), 200)
|
|
|
|
|
|
+ int(size['width'] * 0.5), int(size['height'] * 0.8), 100)
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
+ command = 'adb shell service call statusbar 2'
|
|
|
|
+ process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
|
|
|
+ process.communicate()
|
|
Common.logger(self.log_type, self.crawler).info('打开小程序"小年糕+"')
|
|
Common.logger(self.log_type, self.crawler).info('打开小程序"小年糕+"')
|
|
self.driver.find_elements(By.XPATH, '//*[@text="小年糕+"]')[-1].click()
|
|
self.driver.find_elements(By.XPATH, '//*[@text="小年糕+"]')[-1].click()
|
|
AliyunLogger.logging(
|
|
AliyunLogger.logging(
|
|
@@ -149,6 +154,12 @@ class XiaoNianGaoPlusRecommend:
|
|
|
|
|
|
)
|
|
)
|
|
time.sleep(5)
|
|
time.sleep(5)
|
|
|
|
+ l = self.driver.get_window_size()
|
|
|
|
+ x1 = l['width'] * 0.5
|
|
|
|
+ y1 = l['height'] * 0.25
|
|
|
|
+ y2 = l['height'] * 0.75
|
|
|
|
+ self.driver.swipe(x1, y1, x1, y2, 500)
|
|
|
|
+ time.sleep(2)
|
|
self.get_videoList()
|
|
self.get_videoList()
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
self.driver.quit()
|
|
self.driver.quit()
|
|
@@ -193,7 +204,7 @@ class XiaoNianGaoPlusRecommend:
|
|
current_time = datetime.now()
|
|
current_time = datetime.now()
|
|
previous_day = current_time - timedelta(days=7)
|
|
previous_day = current_time - timedelta(days=7)
|
|
formatted_time = previous_day.strftime("%Y-%m-%d")
|
|
formatted_time = previous_day.strftime("%Y-%m-%d")
|
|
- sql = f""" select * from crawler_video where platform = "{self.platform}" and out_video_id="{out_video_id}" and create_time <= '{formatted_time}'; """
|
|
|
|
|
|
+ sql = f""" select * from crawler_video where platform = "{self.platform}" and out_video_id="{out_video_id}" and create_time >= '{formatted_time}'; """
|
|
Common.logger(self.log_type, self.crawler).info(
|
|
Common.logger(self.log_type, self.crawler).info(
|
|
f"sql{sql}")
|
|
f"sql{sql}")
|
|
repeat_video = MysqlHelper.get_values(
|
|
repeat_video = MysqlHelper.get_values(
|