Skip to content

Commit

Permalink
[downloader:http] add MIME type and signature for .m4v files (#5505)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Apr 24, 2024
1 parent bef0bd3 commit cd241be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gallery_dl/downloader/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ def _adjust_extension(pathfmt, file_header):
"video/webm": "webm",
"video/ogg" : "ogg",
"video/mp4" : "mp4",
"video/m4v" : "m4v",
"video/x-m4v": "m4v",
"video/quicktime": "mov",

"audio/wav" : "wav",
Expand Down Expand Up @@ -443,7 +445,8 @@ def _adjust_extension(pathfmt, file_header):
"cur" : lambda s: s[0:4] == b"\x00\x00\x02\x00",
"psd" : lambda s: s[0:4] == b"8BPS",
"mp4" : lambda s: (s[4:8] == b"ftyp" and s[8:11] in (
b"mp4", b"avc", b"iso", b"M4V")),
b"mp4", b"avc", b"iso")),
"m4v" : lambda s: s[4:11] == b"ftypM4V",
"mov" : lambda s: s[4:12] == b"ftypqt ",
"webm": lambda s: s[0:4] == b"\x1A\x45\xDF\xA3",
"ogg" : lambda s: s[0:4] == b"OggS",
Expand Down
2 changes: 1 addition & 1 deletion test/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def do_GET(self):
("mp4" , b"????ftypmp4"),
("mp4" , b"????ftypavc1"),
("mp4" , b"????ftypiso3"),
("mp4" , b"????ftypM4V"),
("m4v" , b"????ftypM4V"),
("mov" , b"????ftypqt "),
("webm", b"\x1A\x45\xDF\xA3"),
("ogg" , b"OggS"),
Expand Down

0 comments on commit cd241be

Please sign in to comment.