main: changes, fixes

- refactors http session usage across modules
- adjusts video info extraction
- improves temporary directory, concurrency limits, buffering, and error handling in download routines
This commit is contained in:
stefanodvx 2025-04-14 23:45:54 +02:00
parent 10c113f400
commit 58bd5827b3
12 changed files with 171 additions and 51 deletions

View file

@ -12,7 +12,7 @@ import (
"govd/util"
)
var HTTPSession = util.NewHTTPSession()
var httpSession = util.GetHTTPSession()
var ShortExtractor = &models.Extractor{
Name: "Reddit (Short)",
@ -37,7 +37,7 @@ var ShortExtractor = &models.Extractor{
req.AddCookie(cookie)
}
res, err := HTTPSession.Do(req)
res, err := httpSession.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to send request: %w", err)
}
@ -229,7 +229,7 @@ func GetRedditData(host string, slug string) (RedditResponse, error) {
req.AddCookie(cookie)
}
res, err := HTTPSession.Do(req)
res, err := httpSession.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to send request: %w", err)
}