summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordyknon dyknonr5fjp2026-01-17 20:20:24 +0900
committerdyknon dyknonr5fjp2026-01-17 20:20:24 +0900
commit7f3c4d52fead36d78c36fd99e2c8b92d0838f2db (patch)
treeaf0a3c27afb0e134e7114d11e44a4a07e9acc2df
parent0fed2ef8a0affddec329d87b4b4484ee6f741429 (diff)
Consider all unknown mime types as application/octet-stream
-rw-r--r--ytdlsb-main.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ytdlsb-main.c b/ytdlsb-main.c
index 8db1ad0..7b0c0f8 100644
--- a/ytdlsb-main.c
+++ b/ytdlsb-main.c
@@ -181,10 +181,11 @@ int ytdlsb_process_preload(struct ytdlsb_task *t){
CURLINFO_CONTENT_TYPE, &mtype));
if(respc == 200){
f->state = YTDLSB_SB_FAILED;
- if(!mtype
- || strcmp(mtype, "application/octet-stream") == 0
- || strcmp(mtype, "binary/octet-stream") == 0
- ){
+ if(mtype && strcmp(mtype, "image/jpeg") == 0){
+ f->state = YTDLSB_SB_JPEG;
+ }else if(mtype && strcmp(mtype, "image/webp") == 0){
+ f->state = YTDLSB_SB_WEBP;
+ }else{
// twitch returns jpeg images in binary/octet-stream
if(f->data && f->data_len >= 12){
if(memcmp(f->data, "\xff\xd8", 2) == 0){
@@ -196,10 +197,6 @@ int ytdlsb_process_preload(struct ytdlsb_task *t){
f->state = YTDLSB_SB_WEBP;
}
}
- }else if(strcmp(mtype, "image/jpeg") == 0){
- f->state = YTDLSB_SB_JPEG;
- }else if(strcmp(mtype, "image/webp") == 0){
- f->state = YTDLSB_SB_WEBP;
}
if(f->state == YTDLSB_SB_FAILED){
eprintf("invalid storyboard type: %s\n", mtype);