Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Remove no-longer-necessary AuthToken
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarbuzzi committed Jan 15, 2021
1 parent 27b5615 commit 8c302a7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 18 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ tvd (**T**witch **V**OD **D**ownloader) is a command-line tool to download VODs

* If building from source, you must have a client ID with appropriate privileges to query the GQL API for VODs
* Provided releases have an embedded client ID
* You must have an active auth token from an account sign-in
* In a browser, sign into your account and get the value of the `auth-token` cookie

## Download

Expand Down Expand Up @@ -43,7 +41,6 @@ Using a config file is alternative to command-line arguments. It can be used in

The accepted values are:

* `AuthToken` - your login session’s auth token (stored in `auth-token` cookies)
* `ClientID` - your Twitch app’s client ID
* `Quality` (optional) - desired quality (e.g. “720p60”, “480p30”); can use “best” for best available (default: "best")
* `StartTime` – start time in the format "HOURS MINUTES SECONDS" (e.g. "1 24 35" is 1h24m35s)
Expand All @@ -59,7 +56,6 @@ The accepted values are:

All options supported above are also supported through the command-line under the following flags:

* `auth` => `AuthToken`
* `client` => `ClientID`
* `quality` => `Quality`
* `start` => `StartTime`
Expand Down
1 change: 0 additions & 1 deletion config-sample.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
AuthToken = "<access token from browser cookies>"
ClientID="<twitch api client id>"
Quality="best"
StartTime="0 0 0"
Expand Down
11 changes: 0 additions & 11 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

// Config represents a config object containing everything needed to download a VOD
type Config struct {
AuthToken string
ClientID string
Quality string
StartTime string
Expand All @@ -29,16 +28,12 @@ type Config struct {
// Privatize returns a copy of the struct with the ClientID field censored (e.g. for logging)
func (c Config) Privatize() Config {
c2 := c
c2.AuthToken = "********"
c2.ClientID = "********"
return c2
}

// Update replaces any config values in the base object with those present in the passed argument
func (c *Config) Update(c2 Config) {
if c2.AuthToken != "" {
c.AuthToken = c2.AuthToken
}
if c2.ClientID != "" {
c.ClientID = c2.ClientID
}
Expand Down Expand Up @@ -73,9 +68,6 @@ func (c *Config) Update(c2 Config) {
//
// Currently, "OutputFolder" is not validated (needs logic to support Windows paths)
func (c Config) Validate() error {
if len(c.AuthToken) == 0 {
return fmt.Errorf("error: AuthToken missing")
}
if len(c.ClientID) == 0 {
return fmt.Errorf("error: ClientID missing")
}
Expand Down Expand Up @@ -171,9 +163,6 @@ func loadConfig(f string) (Config, error) {
func buildConfigFromFlags() (Config, error) {
var config Config

if *authToken != "" {
config.AuthToken = *authToken
}
if *clientID != "" {
config.ClientID = *clientID
}
Expand Down
2 changes: 0 additions & 2 deletions tvd.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var (
date = "n/a"

DefaultConfig = Config{
AuthToken: "",
ClientID: ClientID,
Workers: 4,
StartTime: "0 0 0",
Expand All @@ -46,7 +45,6 @@ var (

// command-line args/flags
var (
authToken = kingpin.Flag("auth", "Account session access token from browser sign-in session").Short('T').String()
clientID = kingpin.Flag("client", "Twitch app Client ID").Short('C').String()
workers = kingpin.Flag("workers", "Max number of concurrent downloads (default: 4)").Short('w').Int()
configFile = kingpin.Flag("config", "Path to config file (default: $HOME/.config/tvd/config.toml)").Short('c').String()
Expand Down

0 comments on commit 8c302a7

Please sign in to comment.