Skip to content

Commit

Permalink
Fix insecure verify and permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
stargazer39 committed Sep 30, 2022
1 parent 7787a30 commit 09850a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"crypto/tls"
"encoding/json"
"io"
"net/http"
Expand All @@ -16,8 +17,13 @@ type HttpClient struct {
func NewHttpClient() *HttpClient {
jar, _ := cookiejar.New(nil)

tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}

client := &http.Client{
Jar: jar,
Jar: jar,
Transport: tr,
}

return &HttpClient{
Expand Down
2 changes: 1 addition & 1 deletion download.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func DownloadWithHttp(client *http.Client, u string, name string, threads int) (
}

if _, err := os.Stat(name); os.IsNotExist(err) {
if err := os.Mkdir(name, 0644); err != nil {
if err := os.Mkdir(name, 0777); err != nil {
return err, ""
}
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func main() {
dErr, m3u8_file := DownloadWithHttp(client.Client, ur.String(), videoName, *threads)

if dErr != nil {
log.Println(err)
log.Println(dErr, 1)
return
}

Expand Down

0 comments on commit 09850a8

Please sign in to comment.