Use anonymous session for HEAD request.
The default Instaloader headers aren't passed with a simple `requests.head()`, so leakage of user agents such as `"python-requests/2.18.1"` will occur.
This commit is contained in:
		@@ -616,7 +616,7 @@ class Instaloader:
 | 
			
		||||
        def _epoch_to_string(epoch: datetime) -> str:
 | 
			
		||||
            return epoch.strftime('%Y-%m-%d_%H-%M-%S')
 | 
			
		||||
 | 
			
		||||
        date_object = datetime.strptime(requests.head(url).headers["Last-Modified"],
 | 
			
		||||
        date_object = datetime.strptime(self._get_anonymous_session().head(url).headers["Last-Modified"],
 | 
			
		||||
                                        '%a, %d %b %Y %H:%M:%S GMT')
 | 
			
		||||
        if ((format_string_contains_key(self.dirname_pattern, 'profile') or
 | 
			
		||||
             format_string_contains_key(self.dirname_pattern, 'target'))):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user