Better thumbnail extension extraction
This commit is contained in:
parent
e84bc20086
commit
9936a57200
@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -109,7 +110,11 @@ func DownloadAllVideos(db *sql.DB) error {
|
||||
}
|
||||
|
||||
// Write thumbnail
|
||||
thumbnailExt := filepath.Ext(thumbnailUrl)
|
||||
parsedThumbnailUrl, err := url.Parse(thumbnailUrl)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing thumbnail url: %w", err)
|
||||
}
|
||||
thumbnailExt := filepath.Ext(parsedThumbnailUrl.Path)
|
||||
thumbnailFile, err := os.Create(filepath.Join(destinationDir, baseFileName+"-thumb"+thumbnailExt))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating thumbnail: %w", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user