Only download video if request from Discord
This commit is contained in:
		
					parent
					
						
							
								fe5c547055
							
						
					
				
			
			
				commit
				
					
						ac86c5f5ee
					
				
			
		
					 1 changed files with 4 additions and 0 deletions
				
			
		
							
								
								
									
										4
									
								
								app.py
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								app.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -290,6 +290,10 @@ def proxy(video_id):
 | 
			
		|||
    video_width, video_height = get_video_resolution(params) if params else (None, None)
 | 
			
		||||
 | 
			
		||||
    download_allowed = allow_download(params) if params else False
 | 
			
		||||
    request_user_agent = request.headers.get('User-Agent', '')
 | 
			
		||||
    if download_allowed and 'discordbot' not in request_user_agent:
 | 
			
		||||
        logger.info(f"Download ignored for video ID {video_id} due to user agent ({request_user_agent})")
 | 
			
		||||
        download_allowed = False
 | 
			
		||||
    video_quality = get_video_quality(params) if params else None
 | 
			
		||||
    if download_allowed and video_quality is not None:
 | 
			
		||||
        video_in_cdn = is_video_in_cdn(video_id)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue