mirror of
https://github.com/TeamPiped/RYD-Proxy.git
synced 2024-08-14 23:55:54 +00:00
Fix resource leak
This commit is contained in:
parent
9013ba9ad8
commit
4937d85c3a
1 changed files with 3 additions and 4 deletions
7
main.go
7
main.go
|
@ -77,7 +77,7 @@ func getVotes(c *fiber.Ctx, videoId string) error {
|
||||||
return c.Status(400).SendString("Invalid video id")
|
return c.Status(400).SendString("Invalid video id")
|
||||||
}
|
}
|
||||||
|
|
||||||
for true {
|
for {
|
||||||
req, _ := http.NewRequest("GET", "https://returnyoutubedislikeapi.com/Votes?videoId="+videoId+"&likeCount=", nil)
|
req, _ := http.NewRequest("GET", "https://returnyoutubedislikeapi.com/Votes?videoId="+videoId+"&likeCount=", nil)
|
||||||
|
|
||||||
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0")
|
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0")
|
||||||
|
@ -95,6 +95,8 @@ func getVotes(c *fiber.Ctx, videoId string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
ce := resp.Header.Get("Content-Encoding")
|
ce := resp.Header.Get("Content-Encoding")
|
||||||
|
|
||||||
var stream io.Reader
|
var stream io.Reader
|
||||||
|
@ -109,7 +111,4 @@ func getVotes(c *fiber.Ctx, videoId string) error {
|
||||||
|
|
||||||
return c.Status(resp.StatusCode).SendStream(stream)
|
return c.Status(resp.StatusCode).SendStream(stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should never be reached
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue