|  | @@ -7,6 +7,7 @@ from appium import webdriver
 | 
											
												
													
														|  |  from appium.webdriver.webdriver import WebDriver
 |  |  from appium.webdriver.webdriver import WebDriver
 | 
											
												
													
														|  |  from selenium.common.exceptions import NoSuchElementException
 |  |  from selenium.common.exceptions import NoSuchElementException
 | 
											
												
													
														|  |  from selenium.webdriver.common.by import By
 |  |  from selenium.webdriver.common.by import By
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  sys.path.append(os.getcwd())
 |  |  sys.path.append(os.getcwd())
 | 
											
												
													
														|  |  from main.common import Common
 |  |  from main.common import Common
 | 
											
												
													
														|  |  from main.publish import Publish
 |  |  from main.publish import Publish
 | 
											
										
											
												
													
														|  | @@ -117,7 +118,7 @@ class Recommend:
 | 
											
												
													
														|  |                  pause_btn = driver.find_element(By.ID, 'com.tencent.mm:id/eh4')
 |  |                  pause_btn = driver.find_element(By.ID, 'com.tencent.mm:id/eh4')
 | 
											
												
													
														|  |                  pause_btn.click()
 |  |                  pause_btn.click()
 | 
											
												
													
														|  |                  start_time = driver.find_element(By.ID, 'com.tencent.mm:id/l59').get_attribute('name')
 |  |                  start_time = driver.find_element(By.ID, 'com.tencent.mm:id/l59').get_attribute('name')
 | 
											
												
													
														|  | -                start_time = int(start_time.split(':')[0])*60 + int(start_time.split(':')[-1])
 |  | 
 | 
											
												
													
														|  | 
 |  | +                start_time = int(start_time.split(':')[0]) * 60 + int(start_time.split(':')[-1])
 | 
											
												
													
														|  |                  try:
 |  |                  try:
 | 
											
												
													
														|  |                      end_time = driver.find_element(By.ID, 'com.tencent.mm:id/l7i').get_attribute('name')
 |  |                      end_time = driver.find_element(By.ID, 'com.tencent.mm:id/l7i').get_attribute('name')
 | 
											
												
													
														|  |                  except NoSuchElementException:
 |  |                  except NoSuchElementException:
 | 
											
										
											
												
													
														|  | @@ -195,13 +196,21 @@ class Recommend:
 | 
											
												
													
														|  |                      Common.logger(log_type).info('不满足抓取规则,滑动到下一个视频\n')
 |  |                      Common.logger(log_type).info('不满足抓取规则,滑动到下一个视频\n')
 | 
											
												
													
														|  |                      driver.swipe(10, 1600, 10, 300, 200)
 |  |                      driver.swipe(10, 1600, 10, 300, 200)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +                # 连续下载判断
 | 
											
												
													
														|  | 
 |  | +                elif user_name in Feishu.get_values_batch('recommend', 'shipinhao', 'c77cf9')[1][14] \
 | 
											
												
													
														|  | 
 |  | +                        and user_name in Feishu.get_values_batch('recommend', 'shipinhao', 'c77cf9')[2][14]:
 | 
											
												
													
														|  | 
 |  | +                    Common.logger(log_type).info('该用户已连续下载2条视频,滑动到下一个视频\n')
 | 
											
												
													
														|  | 
 |  | +                    driver.swipe(10, 1600, 10, 300, 200)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |                  # 已下载表去重
 |  |                  # 已下载表去重
 | 
											
												
													
														|  | -                elif str(video_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'c77cf9') for x in y]:
 |  | 
 | 
											
												
													
														|  | 
 |  | +                elif str(video_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'c77cf9') for x in
 | 
											
												
													
														|  | 
 |  | +                                          y]:
 | 
											
												
													
														|  |                      Common.logger(log_type).info('视频已下载,滑动到下一个视频\n')
 |  |                      Common.logger(log_type).info('视频已下载,滑动到下一个视频\n')
 | 
											
												
													
														|  |                      driver.swipe(10, 1600, 10, 300, 200)
 |  |                      driver.swipe(10, 1600, 10, 300, 200)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  # feeds 表去重
 |  |                  # feeds 表去重
 | 
											
												
													
														|  | -                elif str(video_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy') for x in y]:
 |  | 
 | 
											
												
													
														|  | 
 |  | +                elif str(video_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy') for x in
 | 
											
												
													
														|  | 
 |  | +                                          y]:
 | 
											
												
													
														|  |                      Common.logger(log_type).info('视频已存在,滑动到下一个视频\n')
 |  |                      Common.logger(log_type).info('视频已存在,滑动到下一个视频\n')
 | 
											
												
													
														|  |                      driver.swipe(10, 1600, 10, 300, 200)
 |  |                      driver.swipe(10, 1600, 10, 300, 200)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -251,12 +260,12 @@ class Recommend:
 | 
											
												
													
														|  |              recommend_feeds_sheet = Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy')
 |  |              recommend_feeds_sheet = Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy')
 | 
											
												
													
														|  |              for i in range(1, len(recommend_feeds_sheet)):
 |  |              for i in range(1, len(recommend_feeds_sheet)):
 | 
											
												
													
														|  |                  download_title = recommend_feeds_sheet[i][2].strip().replace('"', '') \
 |  |                  download_title = recommend_feeds_sheet[i][2].strip().replace('"', '') \
 | 
											
												
													
														|  | -                        .replace('“', '').replace('“', '…').replace("\n", "") \
 |  | 
 | 
											
												
													
														|  | -                        .replace("/", "").replace("\r", "").replace("#", "") \
 |  | 
 | 
											
												
													
														|  | -                        .replace(".", "。").replace("\\", "").replace("&NBSP", "") \
 |  | 
 | 
											
												
													
														|  | -                        .replace(":", "").replace("*", "").replace("?", "") \
 |  | 
 | 
											
												
													
														|  | -                        .replace("?", "").replace('"', "").replace("<", "") \
 |  | 
 | 
											
												
													
														|  | -                        .replace(">", "").replace("|", "").replace(" ", "")
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    .replace('“', '').replace('“', '…').replace("\n", "") \
 | 
											
												
													
														|  | 
 |  | +                    .replace("/", "").replace("\r", "").replace("#", "") \
 | 
											
												
													
														|  | 
 |  | +                    .replace(".", "。").replace("\\", "").replace("&NBSP", "") \
 | 
											
												
													
														|  | 
 |  | +                    .replace(":", "").replace("*", "").replace("?", "") \
 | 
											
												
													
														|  | 
 |  | +                    .replace("?", "").replace('"', "").replace("<", "") \
 | 
											
												
													
														|  | 
 |  | +                    .replace(">", "").replace("|", "").replace(" ", "")
 | 
											
												
													
														|  |                  download_duration = recommend_feeds_sheet[i][3]
 |  |                  download_duration = recommend_feeds_sheet[i][3]
 | 
											
												
													
														|  |                  download_like_cnt = recommend_feeds_sheet[i][4]
 |  |                  download_like_cnt = recommend_feeds_sheet[i][4]
 | 
											
												
													
														|  |                  download_share_cnt = recommend_feeds_sheet[i][5]
 |  |                  download_share_cnt = recommend_feeds_sheet[i][5]
 | 
											
										
											
												
													
														|  | @@ -272,10 +281,11 @@ class Recommend:
 | 
											
												
													
														|  |                  Common.logger(log_type).info("download_video_url:{}", download_video_url)
 |  |                  Common.logger(log_type).info("download_video_url:{}", download_video_url)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  if download_title is None or download_duration is None or download_video_url is None:
 |  |                  if download_title is None or download_duration is None or download_video_url is None:
 | 
											
												
													
														|  | -                    Feishu.dimension_range(log_type, 'shipinhao', 'FSDlBy', 'ROWS', i+1, i+1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    Feishu.dimension_range(log_type, 'shipinhao', 'FSDlBy', 'ROWS', i + 1, i + 1)
 | 
											
												
													
														|  |                      Common.logger(log_type).info('空行,删除成功\n')
 |  |                      Common.logger(log_type).info('空行,删除成功\n')
 | 
											
												
													
														|  |                      return
 |  |                      return
 | 
											
												
													
														|  | -                elif str(download_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'c77cf9') for x in y]:
 |  | 
 | 
											
												
													
														|  | 
 |  | +                elif str(download_title) in [x for y in Feishu.get_values_batch(log_type, 'shipinhao', 'c77cf9') for x
 | 
											
												
													
														|  | 
 |  | +                                             in y]:
 | 
											
												
													
														|  |                      Feishu.dimension_range(log_type, 'shipinhao', 'FSDlBy', 'ROWS', i + 1, i + 1)
 |  |                      Feishu.dimension_range(log_type, 'shipinhao', 'FSDlBy', 'ROWS', i + 1, i + 1)
 | 
											
												
													
														|  |                      Common.logger(log_type).info('视频已下载,删除成功\n')
 |  |                      Common.logger(log_type).info('视频已下载,删除成功\n')
 | 
											
												
													
														|  |                      return
 |  |                      return
 | 
											
										
											
												
													
														|  | @@ -296,7 +306,7 @@ class Recommend:
 | 
											
												
													
														|  |                                    str(download_comment_cnt) + "\n" +
 |  |                                    str(download_comment_cnt) + "\n" +
 | 
											
												
													
														|  |                                    str(download_like_cnt) + "\n" +
 |  |                                    str(download_like_cnt) + "\n" +
 | 
											
												
													
														|  |                                    str(download_share_cnt) + "\n" +
 |  |                                    str(download_share_cnt) + "\n" +
 | 
											
												
													
														|  | -                                  str(1920*1080) + "\n" +
 |  | 
 | 
											
												
													
														|  | 
 |  | +                                  str(1920 * 1080) + "\n" +
 | 
											
												
													
														|  |                                    str(int(time.time())) + "\n" +
 |  |                                    str(int(time.time())) + "\n" +
 | 
											
												
													
														|  |                                    str(download_username) + "\n" +
 |  |                                    str(download_username) + "\n" +
 | 
											
												
													
														|  |                                    str(download_head_url) + "\n" +
 |  |                                    str(download_head_url) + "\n" +
 | 
											
										
											
												
													
														|  | @@ -308,7 +318,8 @@ class Recommend:
 | 
											
												
													
														|  |                      Common.logger(log_type).info("开始上传视频:{}".format(download_title))
 |  |                      Common.logger(log_type).info("开始上传视频:{}".format(download_title))
 | 
											
												
													
														|  |                      our_video_id = Publish.upload_and_publish(log_type, env, "play")
 |  |                      our_video_id = Publish.upload_and_publish(log_type, env, "play")
 | 
											
												
													
														|  |                      if env == 'dev':
 |  |                      if env == 'dev':
 | 
											
												
													
														|  | -                        our_video_link = "https://testadmin.piaoquantv.com/cms/post-detail/" + str(our_video_id) + "/info"
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        our_video_link = "https://testadmin.piaoquantv.com/cms/post-detail/" + str(
 | 
											
												
													
														|  | 
 |  | +                            our_video_id) + "/info"
 | 
											
												
													
														|  |                      else:
 |  |                      else:
 | 
											
												
													
														|  |                          our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(our_video_id) + "/info"
 |  |                          our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(our_video_id) + "/info"
 | 
											
												
													
														|  |                      Common.logger(log_type).info("视频上传完成:{}", our_video_link)
 |  |                      Common.logger(log_type).info("视频上传完成:{}", our_video_link)
 |