|
@@ -11,6 +11,7 @@ from hashlib import md5
|
|
|
|
|
|
from appium import webdriver
|
|
|
from appium.webdriver.extensions.android.nativekey import AndroidKey
|
|
|
+from appium.webdriver.common.touch_action import TouchAction
|
|
|
from bs4 import BeautifulSoup
|
|
|
from selenium.common.exceptions import NoSuchElementException
|
|
|
from selenium.webdriver.common.by import By
|
|
@@ -139,13 +140,19 @@ class XiaoNianGaoPlusRecommend(object):
|
|
|
def swipe_up(self):
|
|
|
self.search_elements('//*[@class="list-list--list"]')
|
|
|
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.442),
|
|
|
- 200,
|
|
|
- )
|
|
|
+ # self.driver.swipe(
|
|
|
+ # int(size["width"] * 0.5),
|
|
|
+ # int(size["height"] * 0.8),
|
|
|
+ # int(size["width"] * 0.5),
|
|
|
+ # int(size["height"] * 0.442),
|
|
|
+ # 200,
|
|
|
+ # )
|
|
|
+ action = TouchAction(self.driver)
|
|
|
+ action.press(x=int(size["width"] * 0.5), y=int(size["height"] * 0.8))
|
|
|
+ action.wait(ms=200) # 可以调整等待时间
|
|
|
+ action.move_to(x=int(size["width"] * 0.5), y=int(size["height"] * 0.442))
|
|
|
+ action.release()
|
|
|
+ action.perform()
|
|
|
self.swipe_count += 1
|
|
|
|
|
|
def get_video_url(self, video_title_element):
|