Merge pull request #25 from Starfer/master

Fixed issue with non-latin characters

Merge comment:
utf-8 is not a standard option in Accept-Encoding, but removing 'br' can still fix the issue. However, to avoid using non-modern browsers without gzip support, it may be better to force users to install Brotli. Apply in next commit. (Reference: https://stackoverflow.com/questions/49584929/unable-to-decode-python-web-request)

This error occurred on my newly installed Python on Windows; there were no issues on my Linux machine.
This commit is contained in:
林果皞
2023-05-01 04:16:47 +08:00
committed by GitHub

View File

@@ -1080,7 +1080,7 @@ def write_log(arg_timestamp_log, url_path, shortform
cprint(''.join([ HIGHER_YELLOW, '%s' % ('\nWrite log increment from last log stored index failed. Fallback to -lt\n\n') ]), attrs=BOLD_ONLY, end='' )
log_timestamp = 'log-pinterest-downloader_' + datetime.now().strftime('%Y-%m-%d %H.%M.%S')
log_path = os.path.join(save_dir, '{}'.format( sanitize(log_timestamp) + '.log' ))
with open(log_path, 'w') as f: # Refer below else:
with open(log_path, 'w', encoding='utf-8') as f: # Refer below else:
f.write('Pinterest Downloader: Version ' + str(__version__) + '\n\n')
else:
@@ -1097,7 +1097,7 @@ def write_log(arg_timestamp_log, url_path, shortform
if img_total == 0: # No need create log when empty folder, but still created .urls above
return False
else:
with open(log_path, 'w') as f: # Reset before append
with open(log_path, 'w', encoding='utf-8') as f: # Reset before append
f.write('Pinterest Downloader: Version ' + str(__version__) + '\n\n') # Easy to recognize if future want to change something
f.write('Input URL: https://www.pinterest.com/' + url_path.rstrip('/') + '/\n') # Reuse/refer when want to update
if shortform: # single pin no need