mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Initial commit
This commit is contained in:
commit
5f1d811c66
23 changed files with 3612 additions and 0 deletions
25
subtitle.go
Normal file
25
subtitle.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package crunchyroll
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Subtitle struct {
|
||||
crunchy *Crunchyroll
|
||||
|
||||
Locale LOCALE `json:"locale"`
|
||||
URL string `json:"url"`
|
||||
Format string `json:"format"`
|
||||
}
|
||||
|
||||
func (s Subtitle) Download(file *os.File) error {
|
||||
resp, err := s.crunchy.Client.Get(s.URL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
_, err = io.Copy(file, resp.Body)
|
||||
return err
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue