diff options
author | Matt Arnold <matt@thegnuguru.org> | 2023-06-05 23:37:41 -0400 |
---|---|---|
committer | Matt Arnold <matt@thegnuguru.org> | 2023-06-05 23:37:41 -0400 |
commit | d3434dc198af745b48ca7ecf02befb8f2c5ee3bf (patch) | |
tree | 5b38cae2f10931162982038c46afa1dd0bf9e40e | |
parent | f4c02022c62135bfebbfdba7c4bca692a74c8c85 (diff) |
here buggy buggy buggy
-rw-r--r-- | main.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/main.go b/main.go index 64e9c9a..94023f7 100644 --- a/main.go +++ b/main.go @@ -224,15 +224,15 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt if err != nil { return nil, err } + resp.Body = io.NopCloser(&tmp) - } else { - _, err = io.Copy(&tmp, resp.Body) - if err != nil { - return nil, err - } - resp.Body.Close() } - if tmp.Len() > 1 { + var tmp2 bytes.Buffer + _, err = io.Copy(&tmp2, resp.Body) + if err != nil { + return nil, err + } + if tmp.Len() < 1 { return nil, errors.New("watson this is weird") } @@ -244,7 +244,7 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt var article GenaricArticle if parser_select { - raw_article, err := readability.FromReader(&tmp, publishUrl) + raw_article, err := readability.FromReader(&tmp2, publishUrl) if err != nil { return nil, err } @@ -255,7 +255,7 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt article.Length = raw_article.Length article.Image = raw_article.Image } else { - raw_article, err := nuparser.FromReader(&tmp) + raw_article, err := nuparser.FromReader(&tmp2) if err != nil { return nil, err } |