| 
					
				 | 
			
			
				@@ -43,7 +43,7 @@ class KS: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for i in range(3): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cookie = Material.get_cookie_data(feishu_id, cookie_sheet, channel_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time.sleep(random.randint(5, 10)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            time.sleep(random.randint(1, 5)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payload = json.dumps({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "operationName": "visionProfilePhotoList", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "variables": { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,37 +88,40 @@ class KS: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             pcursor = response.json()['data']['visionProfilePhotoList']['pcursor'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             feeds = response.json()['data']['visionProfilePhotoList']['feeds'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for i in range(len(feeds)): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    video_id = feeds[i].get("photo", {}).get("videoResource").get("h264", {}).get("videoId", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                except KeyError: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    video_id = feeds[i].get("photo", {}).get("videoResource").get("hevc", {}).get("videoId", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                status = sqlCollect.is_used(task_mark, video_id, mark, channel_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if status: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    video_id = feeds[i].get("photo", {}).get("id", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for i in range(len(feeds)): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        video_id = feeds[i].get("photo", {}).get("videoResource").get("h264", {}).get("videoId", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    except KeyError: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        video_id = feeds[i].get("photo", {}).get("videoResource").get("hevc", {}).get("videoId", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     status = sqlCollect.is_used(task_mark, video_id, mark, channel_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if status: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        share_count = cls.get_share_count(video_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        old_title = feeds[i].get("photo", {}).get("caption") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        cover_url = feeds[i].get('photo', {}).get('coverUrl', "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_url = feeds[i].get('photo', {}).get('photoUrl', "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        view_count = int(feeds[i].get('photo', {}).get('viewCount', 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        video_percent = '%.4f' % (share_count / view_count) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        duration = dataHelp.video_duration(video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Common.logger("ks").info( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        special = float(0.001) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if float(video_percent) < special or share_count < 500 or duration < 30 or duration > 720: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        video_id = feeds[i].get("photo", {}).get("id", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        status = sqlCollect.is_used(task_mark, video_id, mark, channel_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if status: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            share_count = cls.get_share_count(video_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            old_title = feeds[i].get("photo", {}).get("caption") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            cover_url = feeds[i].get('photo', {}).get('coverUrl', "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_url = feeds[i].get('photo', {}).get('photoUrl', "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            view_count = int(feeds[i].get('photo', {}).get('viewCount', 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            realLikeCount = int(feeds[i].get('photo', {}).get('realLikeCount', 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            video_percent = '%.4f' % (share_count / view_count) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            duration = dataHelp.video_duration(video_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             Common.logger("ks").info( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            continue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        all_data = {"video_id": video_id, "cover": cover_url, "video_url": video_url, "rule": video_percent, "old_title": old_title} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        list.append(all_data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if len(list) == int(number): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            Common.logger("log").info(f"获取快手视频总数:{len(list)}\n") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            return list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                f"扫描:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            special = float(0.001) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if float(video_percent) < special or share_count < 500 or duration < 30 or duration > 720: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger("ks").info( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    f"不符合规则:{task_mark},用户主页id:{url_id},视频id{video_id} ,播放数:{view_count} ,分享数:{share_count},时长:{duration} ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                continue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            all_data = {"video_id": video_id, "cover": cover_url, "video_url": video_url, "rule": video_percent, "old_title": old_title} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            list.append(all_data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if len(list) == int(number): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Common.logger("log").info(f"获取快手视频总数:{len(list)}\n") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                return list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            except Exception as exc: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Common.logger("warning").warning(f"{name}的快手获取数据失败:{exc}\n") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == '__main__': 
			 |