|
@@ -1,6 +1,7 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
# @Author: wangkun
|
|
|
# @Time: 2022/11/15
|
|
|
+import difflib
|
|
|
import os
|
|
|
import shutil
|
|
|
import sys
|
|
@@ -44,8 +45,8 @@ class Recommend:
|
|
|
'enableWebviewDetailsCollection': True,
|
|
|
'setWebContentsDebuggingEnabled': True,
|
|
|
'recreateChromeDriverSessions': True,
|
|
|
- # 'chromedriverExecutable': '/Users/wangkun/Downloads/chromedriver_v86/chromedriver',
|
|
|
- 'chromedriverExecutable': '/Users/piaoquan/Downloads/chromedriver',
|
|
|
+ 'chromedriverExecutable': '/Users/wangkun/Downloads/chromedriver_v86/chromedriver',
|
|
|
+ # 'chromedriverExecutable': '/Users/piaoquan/Downloads/chromedriver',
|
|
|
"chromeOptions": {"androidProcess": "com.tencent.mm:appbrand0"},
|
|
|
'browserName': ''
|
|
|
}
|
|
@@ -71,8 +72,8 @@ class Recommend:
|
|
|
int(size['width'] * 0.5), int(size['height'] * 0.8), 200)
|
|
|
# 打开小程序"祝福猫视频"
|
|
|
time.sleep(3)
|
|
|
- Common.logger(log_type).info('打开小程序"祝福猫视频"')
|
|
|
- driver.find_elements(By.XPATH, '//*[@text="祝福猫视频"]')[-1].click()
|
|
|
+ Common.logger(log_type).info('打开小程序"长寿视频"')
|
|
|
+ driver.find_elements(By.XPATH, '//*[@text="长寿视频"]')[-1].click()
|
|
|
cls.get_recommend(log_type, driver, env)
|
|
|
cls.quit(log_type, driver)
|
|
|
except Exception as e:
|
|
@@ -208,6 +209,18 @@ class Recommend:
|
|
|
cls.quit(log_type, driver)
|
|
|
cls.start_wechat(log_type, env)
|
|
|
|
|
|
+ @classmethod
|
|
|
+ def title_like(cls, log_type, title):
|
|
|
+ sheet = Feishu.get_values_batch(log_type, 'zhufumao', 'e13bdf')
|
|
|
+ for i in range(1, len(sheet)):
|
|
|
+ video_title = sheet[i][7]
|
|
|
+ if video_title is None:
|
|
|
+ pass
|
|
|
+ elif difflib.SequenceMatcher(None, title, video_title).quick_ratio() >= 0.8:
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ pass
|
|
|
+
|
|
|
@classmethod
|
|
|
def download_publish(cls, log_type, driver: WebDriver, video_element, video_title, cover_url, env):
|
|
|
try:
|
|
@@ -215,6 +228,8 @@ class Recommend:
|
|
|
Common.logger(log_type).info('无效视频\n')
|
|
|
elif video_title in [x for y in Feishu.get_values_batch(log_type, 'zhufumao', 'e13bdf') for x in y]:
|
|
|
Common.logger(log_type).info('视频已下载\n')
|
|
|
+ elif cls.title_like(log_type, video_title) is True:
|
|
|
+ Common.logger(log_type).info('标题相似度>=80%:{}\n', video_title)
|
|
|
elif any(word if word in video_title else False for word in cls.filter_words(log_type)) is True:
|
|
|
Common.logger(log_type).info('已中过滤词\n')
|
|
|
else:
|