|
@@ -7,9 +7,12 @@ from appium import webdriver
|
|
|
from appium.webdriver.webdriver import WebDriver
|
|
|
from selenium.common import NoSuchElementException
|
|
|
from selenium.webdriver.common.by import By
|
|
|
+
|
|
|
sys.path.append(os.getcwd())
|
|
|
-from main.common import Common
|
|
|
-from main.feishu_lib import Feishu
|
|
|
+from crawler_shipinhao.main.common import Common
|
|
|
+from crawler_shipinhao.main.feishu_lib import Feishu
|
|
|
+from crawler_shipinhao.main.click_share_video import Click
|
|
|
+from crawler_shipinhao.main.get_url import GetUrl
|
|
|
|
|
|
|
|
|
class Recommend:
|
|
@@ -208,23 +211,35 @@ class Recommend:
|
|
|
driver.find_element(By.XPATH, '//*[@text="爬虫群"]').click()
|
|
|
driver.find_element(By.ID, 'com.tencent.mm:id/guw').click()
|
|
|
|
|
|
- # 把视频信息写入飞书feeds文档
|
|
|
- Feishu.insert_columns(log_type, 'shipinhao', 'FSDlBy', 'ROWS', 1, 2)
|
|
|
- get_feeds_time = int(time.time())
|
|
|
- values = [[time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(get_feeds_time)),
|
|
|
- '推荐榜',
|
|
|
- str(video_title),
|
|
|
- duration,
|
|
|
- like_cnt,
|
|
|
- share_cnt,
|
|
|
- favorite_cnt,
|
|
|
- comment_cnt,
|
|
|
- str(user_name)]]
|
|
|
+ Click.click_video(log_type, video_title)
|
|
|
time.sleep(1)
|
|
|
- Feishu.update_values(log_type, 'shipinhao', 'FSDlBy', 'A2:Z2', values)
|
|
|
- Common.logger(log_type).info('向上滑动页面')
|
|
|
- driver.swipe(500, 1000, 500, 300, 300)
|
|
|
- Common.logger(log_type).info('视频信息写入飞书文档成功\n')
|
|
|
+
|
|
|
+ urls = GetUrl.get_url(log_type)
|
|
|
+ if urls is None:
|
|
|
+ Common.logger(log_type).info('未获取到视频 URL')
|
|
|
+ else:
|
|
|
+ video_url = urls[0]
|
|
|
+ cover_url = urls[1]
|
|
|
+
|
|
|
+ # 把视频信息写入飞书feeds文档
|
|
|
+ Feishu.insert_columns(log_type, 'shipinhao', 'FSDlBy', 'ROWS', 1, 2)
|
|
|
+ get_feeds_time = int(time.time())
|
|
|
+ values = [[time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(get_feeds_time)),
|
|
|
+ '推荐榜',
|
|
|
+ str(video_title),
|
|
|
+ duration,
|
|
|
+ like_cnt,
|
|
|
+ share_cnt,
|
|
|
+ favorite_cnt,
|
|
|
+ comment_cnt,
|
|
|
+ str(user_name),
|
|
|
+ cover_url,
|
|
|
+ video_url]]
|
|
|
+ time.sleep(1)
|
|
|
+ Feishu.update_values(log_type, 'shipinhao', 'FSDlBy', 'A2:Z2', values)
|
|
|
+ Common.logger(log_type).info('向上滑动页面')
|
|
|
+ driver.swipe(500, 1000, 500, 300, 300)
|
|
|
+ Common.logger(log_type).info('视频信息写入飞书文档成功\n')
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|