add filename

This commit is contained in:
Antonio J. Delgado 2024-12-28 19:32:44 +02:00
parent 738eae5bdb
commit c092abfa5d

View file

@ -121,12 +121,13 @@ class GetPeertubeVideos:
self.downloaded_items.append(item['id']) self.downloaded_items.append(item['id'])
self._write_downloaded_items() self._write_downloaded_items()
elif 'video' in selected['type']: elif 'video' in selected['type']:
self._log.info(
"Downloading video '%s'...",
selected['url']
)
file_extension = selected['type'].replace('video/', '.') file_extension = selected['type'].replace('video/', '.')
file_name = os.path.join(self.config['download_dir'], item['title'], file_extension) file_name = os.path.join(self.config['download_dir'], item['title'], file_extension)
self._log.info(
"Downloading video '%s' as '%s'...",
selected['url'],
file_name
)
result = self.session.get(selected['url']) result = self.session.get(selected['url'])
video_bytes = result.content video_bytes = result.content
with open(file_name, mode='wb') as video_file: with open(file_name, mode='wb') as video_file: