summaryrefslogtreecommitdiffstats
path: root/gallery_dl/downloader
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/downloader')
-rw-r--r--gallery_dl/downloader/text.py4
-rw-r--r--gallery_dl/downloader/ytdl.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/gallery_dl/downloader/text.py b/gallery_dl/downloader/text.py
index c57fbd0..a668d62 100644
--- a/gallery_dl/downloader/text.py
+++ b/gallery_dl/downloader/text.py
@@ -18,8 +18,8 @@ class TextDownloader(DownloaderBase):
if self.part:
pathfmt.part_enable(self.partdir)
self.out.start(pathfmt.path)
- with pathfmt.open("wb") as file:
- file.write(url.encode()[5:])
+ with pathfmt.open("wb") as fp:
+ fp.write(url.encode()[5:])
return True
diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py
index adada75..87e7756 100644
--- a/gallery_dl/downloader/ytdl.py
+++ b/gallery_dl/downloader/ytdl.py
@@ -89,6 +89,11 @@ class YoutubeDLDownloader(DownloaderBase):
formats = info_dict.get("requested_formats")
if formats and not compatible_formats(formats):
info_dict["ext"] = "mkv"
+ elif "ext" not in info_dict:
+ try:
+ info_dict["ext"] = info_dict["formats"][0]["ext"]
+ except LookupError:
+ info_dict["ext"] = "mp4"
if self.outtmpl:
self._set_outtmpl(ytdl_instance, self.outtmpl)