1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-03 22:07:11 +02:00

write caption in text mode (#1632)

This commit is contained in:
fireattack 2022-07-14 14:00:24 -05:00 committed by GitHub
parent 5e232fd4f5
commit 4bb32e3c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -478,9 +478,8 @@ class Instaloader:
self.context.log(pcaption, end=' ', flush=True)
except UnicodeEncodeError:
self.context.log('txt', end=' ', flush=True)
with open(filename, 'wb') as text_file:
with BytesIO(bcaption) as bio:
shutil.copyfileobj(cast(IO, bio), text_file)
with open(filename, 'w', encoding='UTF-8') as fio:
fio.write(caption)
os.utime(filename, (datetime.now().timestamp(), mtime.timestamp()))
def save_location(self, filename: str, location: PostLocation, mtime: datetime) -> None: