mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	[theplatform] Fix for Python 3.2
test_AENetworks{,_1} fails as in Python < 3.3, binascii.a2b_* functions
accepts only bytes-like objects
			
			
This commit is contained in:
		@@ -159,11 +159,11 @@ class ThePlatformIE(ThePlatformBaseIE):
 | 
				
			|||||||
        def str_to_hex(str):
 | 
					        def str_to_hex(str):
 | 
				
			||||||
            return binascii.b2a_hex(str.encode('ascii')).decode('ascii')
 | 
					            return binascii.b2a_hex(str.encode('ascii')).decode('ascii')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def hex_to_str(hex):
 | 
					        def hex_to_bytes(hex):
 | 
				
			||||||
            return binascii.a2b_hex(hex)
 | 
					            return binascii.a2b_hex(hex.encode('ascii'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        relative_path = re.match(r'https?://link.theplatform.com/s/([^?]+)', url).group(1)
 | 
					        relative_path = re.match(r'https?://link.theplatform.com/s/([^?]+)', url).group(1)
 | 
				
			||||||
        clear_text = hex_to_str(flags + expiration_date + str_to_hex(relative_path))
 | 
					        clear_text = hex_to_bytes(flags + expiration_date + str_to_hex(relative_path))
 | 
				
			||||||
        checksum = hmac.new(sig_key.encode('ascii'), clear_text, hashlib.sha1).hexdigest()
 | 
					        checksum = hmac.new(sig_key.encode('ascii'), clear_text, hashlib.sha1).hexdigest()
 | 
				
			||||||
        sig = flags + expiration_date + checksum + str_to_hex(sig_secret)
 | 
					        sig = flags + expiration_date + checksum + str_to_hex(sig_secret)
 | 
				
			||||||
        return '%s&sig=%s' % (url, sig)
 | 
					        return '%s&sig=%s' % (url, sig)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user