| 
														
															@@ -5,12 +5,33 @@ import json 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import os 
														 | 
														
														 | 
														
															 import os 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import sys 
														 | 
														
														 | 
														
															 import sys 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import time 
														 | 
														
														 | 
														
															 import time 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+# import atomacos 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+from appium import webdriver 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+from selenium.webdriver.common.by import By 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 sys.path.append(os.getcwd()) 
														 | 
														
														 | 
														
															 sys.path.append(os.getcwd()) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from crawler_shipinhao.main.common import Common 
														 | 
														
														 | 
														
															 from crawler_shipinhao.main.common import Common 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+from crawler_shipinhao.main.feishu_lib import Feishu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # from main.common import Common 
														 | 
														
														 | 
														
															 # from main.common import Common 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 class GetUrl: 
														 | 
														
														 | 
														
															 class GetUrl: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @classmethod 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    def click_video(cls, log_type, video_title): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Common.logger(log_type).info('启动"微信"') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        desired_caps = {'app': r"C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        driver = webdriver.Remote( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            command_executor='http://127.0.0.1:4723', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            desired_capabilities=desired_caps) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        driver.implicitly_wait(10) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Common.logger(log_type).info('点击"爬虫群"') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        driver.find_element(By.NAME, '爬虫群').click() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Common.logger(log_type).info('点击视频:{}', video_title) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        driver.find_element(By.NAME, video_title).click() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        time.sleep(5) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        driver.quit() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @classmethod 
														 | 
														
														 | 
														
															     @classmethod 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     def get_url(cls, log_type): 
														 | 
														
														 | 
														
															     def get_url(cls, log_type): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         try: 
														 | 
														
														 | 
														
															         try: 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -45,13 +66,14 @@ class GetUrl: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     for text in contents: 
														 | 
														
														 | 
														
															                     for text in contents: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         if text["host"] == "finder.video.qq.com" and text["path"] == "/251/20302/stodownload": 
														 | 
														
														 | 
														
															                         if text["host"] == "finder.video.qq.com" and text["path"] == "/251/20302/stodownload": 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                             video_url_list.append(text) 
														 | 
														
														 | 
														
															                             video_url_list.append(text) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        elif text["host"] == "finder.video.qq.com" and text["path"] == "/251/20350/stodownload": 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        elif text["host"] == "finder.video.qq.com" and text["path"] == "/251/20304/stodownload": 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                             cover_url_list.append(text) 
														 | 
														
														 | 
														
															                             cover_url_list.append(text) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     video_url = video_url_list[0]['host']+video_url_list[0]['path']+'?'+video_url_list[0]['query'] 
														 | 
														
														 | 
														
															                     video_url = video_url_list[0]['host']+video_url_list[0]['path']+'?'+video_url_list[0]['query'] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     cover_url = cover_url_list[0]['host']+cover_url_list[0]['path']+'?'+cover_url_list[0]['query'] 
														 | 
														
														 | 
														
															                     cover_url = cover_url_list[0]['host']+cover_url_list[0]['path']+'?'+cover_url_list[0]['query'] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    head_url = cover_url 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    return video_url, cover_url 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    return video_url, cover_url, head_url 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 else: 
														 | 
														
														 | 
														
															                 else: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     Common.logger(log_type).info("未找到 url,10s后重新获取") 
														 | 
														
														 | 
														
															                     Common.logger(log_type).info("未找到 url,10s后重新获取") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     time.sleep(10) 
														 | 
														
														 | 
														
															                     time.sleep(10) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -61,6 +83,21 @@ class GetUrl: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Common.logger(log_type).exception("get_url异常:{}", e) 
														 | 
														
														 | 
														
															             Common.logger(log_type).exception("get_url异常:{}", e) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return None 
														 | 
														
														 | 
														
															             return None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @classmethod 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    def write_url(cls, log_type): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        while True: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy')[1][11] is None: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                Common.logger(log_type).info('开始点击分享的视频') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                cls.click_video(log_type, Feishu.get_values_batch(log_type, 'shipinhao', 'FSDlBy')[1][2]) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                time.sleep(60) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                Common.logger(log_type).info('获取视频头像/封面/播放地址') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                urls = cls.get_url(log_type) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                Feishu.update_values(log_type, 'shipinhao', '', 'J2:L2', [[urls[2], urls[1], urls[0]]]) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                Common.logger(log_type).info('视频地址信息写入飞书成功\n') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                break 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            else: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                break 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 if __name__ == '__main__': 
														 | 
														
														 | 
														
															 if __name__ == '__main__': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     GetUrl.get_url('recommend') 
														 | 
														
														 | 
														
															     GetUrl.get_url('recommend') 
														 |