wangkun пре 1 година
родитељ
комит
f75aded849
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7 7
      shipinhao/shipinhao_search/shipinhao_search.py

+ 7 - 7
shipinhao/shipinhao_search/shipinhao_search.py

@@ -194,10 +194,10 @@ class ShipinhaoSearch:
         }
         driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
         driver.implicitly_wait(10)
-        Common.logger(log_type, crawler).info("点击微信")
+        # Common.logger(log_type, crawler).info("点击微信")
         # if len(driver.find_elements(By.ID, 'android:id/text1')) != 0:
         #     driver.find_elements(By.ID, 'android:id/text1')[0].click()
-        Common.logger(log_type, crawler).info("等待 5s")
+        # Common.logger(log_type, crawler).info("等待 5s")
         time.sleep(5)
         cls.search_video(log_type=log_type,
                          crawler=crawler,
@@ -273,11 +273,11 @@ class ShipinhaoSearch:
         Common.logger(log_type, crawler).info("点击微信搜索框")
         driver.find_element(By.ID, 'com.tencent.mm:id/j5t').click()
         time.sleep(0.5)
-        Common.logger(log_type, crawler).info(f'输入搜索词:{word}')
+        # Common.logger(log_type, crawler).info(f'输入搜索词:{word}')
         driver.find_element(By.ID, 'com.tencent.mm:id/cd7').clear().send_keys(word)
         driver.press_keycode(AndroidKey.ENTER)
         # driver.find_elements(By.ID, 'com.tencent.mm:id/oi4')[0].click()
-        Common.logger(log_type, crawler).info("点击搜索,进入搜索页")
+        Common.logger(log_type, crawler).info("进入搜索")
         # driver.find_elements(By.ID, 'com.tencent.mm:id/oi4')[0].click()
         driver.find_elements(By.ID, 'com.tencent.mm:id/br8')[0].click()
         time.sleep(5)
@@ -340,10 +340,10 @@ class ShipinhaoSearch:
                 video_url = video_element.find_elements(By.XPATH, '//div[@class="video-player"]')[index+i].get_attribute('src')
                 cover_url = video_element.find_elements(By.XPATH, '//div[@class="video-player__bd"]')[index+i].get_attribute('style')
                 cover_url = cover_url.split('url("')[-1].split('")')[0]
-                duration = video_element.find_elements(By.XPATH, '//div[@class="play-mask__text"]/*[2]')[index+i].text
+                duration = video_element.find_elements(By.XPATH, '//div[@class="video-player-mask__text"]')[index+i].text
                 duration = int(duration.split(':')[0]) * 60 + int(duration.split(':')[-1])
-                user_name = video_element.find_elements(By.XPATH, '//p[@class="vc-source__text"]')[index+i].text
-                avatar_url = video_element.find_elements(By.XPATH, '//div[@class="ui-image-image ui-image vc-source__thumb"]')[index+i].get_attribute('style')
+                user_name = video_element.find_elements(By.XPATH, '//div[@class="rich-media__source__title"]')[index+i].text
+                avatar_url = video_element.find_elements(By.XPATH, '//div[@class="ui-image-image ui-image rich-media__source__thumb"]')[index+i].get_attribute('style')
                 avatar_url = avatar_url.split('url("')[-1].split('")')[0]
                 out_video_id = md5(video_title.encode('utf8')).hexdigest()
                 out_user_id = md5(user_name.encode('utf8')).hexdigest()