Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.52 #137

Merged
merged 4 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions extractors/haho/haho_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package haho

/*
import (
"testing"

Expand Down Expand Up @@ -60,4 +59,3 @@ func TestExtract(t *testing.T) {
})
}
}
*/
6 changes: 3 additions & 3 deletions extractors/hstream/hstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ func TestExtract(t *testing.T) {
{
Name: "Single Episode 4k legacy",
Args: test.Args{
URL: "https://hstream.moe/hentai/wizard-girl-ambitious/1",
Title: "Wizard Girl Ambitious - 1",
URL: "https://hstream.moe/hentai/aku-no-onna-kanbu-full-moon-night-r-1",
Title: "Aku no Onna Kanbu: Full Moon Night R - 1",
Quality: "av1.2160p.webm",
Size: 804660690,
Size: 397722506,
},
},
{
Expand Down
6 changes: 3 additions & 3 deletions extractors/iwara/iwara_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func TestExtract(t *testing.T) {
{
Name: "Single video",
Args: test.Args{
URL: "https://www.iwara.tv/video/jemn7sgm7wuw0oqv9/r-18-observation-diary",
Title: "【R-18】電ちん観察日記 OBSERVATION DIARY",
URL: "https://www.iwara.tv/video/zwkobu5eevi17m309/14",
Title: "14.舞夜の侍奉Ⅱ💕",
Quality: "Source",
Size: 232156387,
Size: 90608128,
},
},
{
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/gan-of-culture/jsurl v0.0.0-20221216084718-9978d7873326
github.com/schollz/progressbar/v3 v3.13.1
github.com/google/brotli/go/cbrotli v0.0.0-20231026090320-9b83be233e0e
)

require (
Expand Down
11 changes: 2 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gan-of-culture/jsurl v0.0.0-20221216084718-9978d7873326 h1:UUgYxgCE9R7KU5b530r1MCKrwAm161C5rJLVlojtWtU=
github.com/gan-of-culture/jsurl v0.0.0-20221216084718-9978d7873326/go.mod h1:2cT4Y46i0jdInrUftQvudioJAkCZAhuLbHK9cL1v51s=
github.com/google/brotli/go/cbrotli v0.0.0-20231026090320-9b83be233e0e h1:q7hxkkc0sikXStQES2u4sYPVuNGMj8NUagcKAZp0sDI=
github.com/google/brotli/go/cbrotli v0.0.0-20231026090320-9b83be233e0e/go.mod h1:nOPhAkwVliJdNTkj3gXpljmWhjc4wCaVqbMJcPKWP4s=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
Expand All @@ -25,16 +26,8 @@ golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
19 changes: 17 additions & 2 deletions request/request.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package request

import (
"compress/flate"
"compress/gzip"
"crypto/tls"
"errors"
"io"
Expand All @@ -12,6 +14,7 @@ import (

"github.com/gan-of-culture/get-sauce/config"
"github.com/gan-of-culture/get-sauce/utils"
"github.com/google/brotli/go/cbrotli"
)

// LogRedirects to sanitize "Location" URLs
Expand Down Expand Up @@ -116,13 +119,25 @@ func GetAsBytes(URL string) ([]byte, error) {
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
var reader io.ReadCloser
switch resp.Header.Get("Content-Encoding") {
case "br":
reader = cbrotli.NewReader(resp.Body)
case "gzip":
reader, _ = gzip.NewReader(resp.Body)
case "deflate":
reader = flate.NewReader(resp.Body)
default:
reader = resp.Body
}
defer reader.Close()

body, err := io.ReadAll(reader)
if err != nil {
if err != io.ErrUnexpectedEOF {
return nil, err
}
}

return body, nil
}

Expand Down