Some checks are pending
build / build (push) Waiting to run
This uses RSS to fetch a list of videos to avoid the vid being invisible due to "restrictions", then downloads the videos one-by-one instead of scraping and parsing the channel page using yt-dlp. We lose metadata for the entire channel (show-level) so introducing a hack to download just the metadata of a channel.
48 lines
772 B
Go
48 lines
772 B
Go
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
type Provider struct {
|
|
Url string
|
|
Throttle int
|
|
Cmd string
|
|
Cookies_file string
|
|
Opml_file string
|
|
Quality string
|
|
Output_path_template string
|
|
Po_token string
|
|
Verbose bool
|
|
Bgutil_server string
|
|
Player_client string
|
|
}
|
|
|
|
type Config struct {
|
|
Out_dir string
|
|
Provider map[string]Provider
|
|
Dry_run bool
|
|
Daemon bool
|
|
}
|
|
|
|
func Load(filepath string) (Config, error) {
|
|
data, err := os.ReadFile(filepath)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
cfg := Config{}
|
|
|
|
err = json.Unmarshal(data, &cfg)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
log.Println("Loaded config:")
|
|
log.Printf("%+v\n", cfg)
|
|
|
|
return cfg, err
|
|
}
|