|
@@ -103,8 +103,10 @@ class Recommend:
|
|
int(size['height'] * 0.8), 200)
|
|
int(size['height'] * 0.8), 200)
|
|
# 打开小程序"知青总群"
|
|
# 打开小程序"知青总群"
|
|
time.sleep(3)
|
|
time.sleep(3)
|
|
- Common.logger(log_type).info('打开小程序"知青总群"')
|
|
|
|
- driver.find_elements(By.XPATH, '//*[@text="知青总群"]')[-1].click()
|
|
|
|
|
|
+ # Common.logger(log_type).info('打开小程序"知青总群"')
|
|
|
|
+ Common.logger(log_type).info('打开小程序"知青天天看"')
|
|
|
|
+ # driver.find_elements(By.XPATH, '//*[@text="知青总群"]')[-1].click()
|
|
|
|
+ driver.find_elements(By.XPATH, '//*[@text="知青天天看"]')[-1].click()
|
|
# 获取视频信息
|
|
# 获取视频信息
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
cls.get_recommend(log_type, driver, env)
|
|
cls.get_recommend(log_type, driver, env)
|
|
@@ -156,18 +158,24 @@ class Recommend:
|
|
try:
|
|
try:
|
|
# 切换到 webview
|
|
# 切换到 webview
|
|
webview = driver.contexts
|
|
webview = driver.contexts
|
|
- Common.logger(log_type).info('webview:{}', webview)
|
|
|
|
|
|
+ # Common.logger(log_type).info('webview:{}', webview)
|
|
Common.logger(log_type).info('切换到小程序\n')
|
|
Common.logger(log_type).info('切换到小程序\n')
|
|
# driver.switch_to.context('WEBVIEW_com.tencent.mm:appbrand0')
|
|
# driver.switch_to.context('WEBVIEW_com.tencent.mm:appbrand0')
|
|
driver.switch_to.context(webview[1])
|
|
driver.switch_to.context(webview[1])
|
|
time.sleep(5)
|
|
time.sleep(5)
|
|
- cls.switch_to_handle(log_type, driver, env, '知青总群')
|
|
|
|
|
|
+ cls.switch_to_handle(log_type, driver, env, '知青天天看')
|
|
break
|
|
break
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger(log_type).warning('切换到小程序失败,重启APP:{}\n', e)
|
|
Common.logger(log_type).warning('切换到小程序失败,重启APP:{}\n', e)
|
|
cls.quit(log_type, driver)
|
|
cls.quit(log_type, driver)
|
|
cls.start_wechat(log_type, env)
|
|
cls.start_wechat(log_type, env)
|
|
|
|
|
|
|
|
+ # Common.logger(log_type).info('点击"换"按钮')
|
|
|
|
+ # try:
|
|
|
|
+ # driver.find_element(By.XPATH, '//wx-view[@class="refreshbtnbox"]').click()
|
|
|
|
+ # except NoSuchElementException:
|
|
|
|
+ # Common.logger(log_type).warning('未点击到"换"按钮')
|
|
|
|
+
|
|
time.sleep(5)
|
|
time.sleep(5)
|
|
Common.logger(log_type).info('获取推荐列表视频信息')
|
|
Common.logger(log_type).info('获取推荐列表视频信息')
|
|
while True:
|
|
while True:
|
|
@@ -210,8 +218,8 @@ class Recommend:
|
|
'//*[@class="videolistbox videolist--videolistbox"]'
|
|
'//*[@class="videolistbox videolist--videolistbox"]'
|
|
'/*[' + str(cls.i) + ']//*[@class="itemimage videolist--itemimage"]')\
|
|
'/*[' + str(cls.i) + ']//*[@class="itemimage videolist--itemimage"]')\
|
|
.get_attribute('src')
|
|
.get_attribute('src')
|
|
- except Exception as e:
|
|
|
|
- Common.logger(log_type).error('cover_url异常:{}', e)
|
|
|
|
|
|
+ except Exception:
|
|
|
|
+ # Common.logger(log_type).error('cover_url异常:{}', e)
|
|
cover_url = 0
|
|
cover_url = 0
|
|
|
|
|
|
# video_url
|
|
# video_url
|
|
@@ -256,8 +264,8 @@ class Recommend:
|
|
driver.press_keycode(4)
|
|
driver.press_keycode(4)
|
|
|
|
|
|
cls.download_publish(log_type, env)
|
|
cls.download_publish(log_type, env)
|
|
- except Exception as e:
|
|
|
|
- Common.logger(log_type).error('switch_to.window(recommend_handle)异常:{}', e)
|
|
|
|
|
|
+ except Exception:
|
|
|
|
+ # Common.logger(log_type).error('switch_to.window(recommend_handle)异常:{}', e)
|
|
pass
|
|
pass
|
|
|
|
|
|
if cls.i == 200:
|
|
if cls.i == 200:
|
|
@@ -306,7 +314,7 @@ class Recommend:
|
|
download_comment_cnt = 0
|
|
download_comment_cnt = 0
|
|
download_like_cnt = 0
|
|
download_like_cnt = 0
|
|
download_share_cnt = 0
|
|
download_share_cnt = 0
|
|
- download_user_name = '知青总群'
|
|
|
|
|
|
+ download_user_name = '知青天天看'
|
|
download_head_url = download_cover_url
|
|
download_head_url = download_cover_url
|
|
|
|
|
|
if download_video_title is None or download_video_url is None:
|
|
if download_video_title is None or download_video_url is None:
|