Fix repair :)
This commit is contained in:
@@ -277,24 +277,25 @@ func (rd *RealDebrid) UnrestrictLink(link string) (*UnrestrictResponse, error) {
|
||||
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
// at this point, any errors mean that the link has expired and we need to repair it
|
||||
resp, err := rd.client.Do(req)
|
||||
if err != nil {
|
||||
rd.log.Errorf("Error when executing the unrestrict link request: %v", err)
|
||||
return nil, err
|
||||
// rd.log.Errorf("Error when executing the unrestrict link request: %v", err)
|
||||
return nil, fmt.Errorf("unrestrict link request failed so likely it has expired")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
rd.log.Errorf("Error when reading the body of unrestrict link response: %v", err)
|
||||
return nil, err
|
||||
// rd.log.Errorf("Error when reading the body of unrestrict link response: %v", err)
|
||||
return nil, fmt.Errorf("unreadable body so likely it has expired")
|
||||
}
|
||||
|
||||
var response UnrestrictResponse
|
||||
err = json.Unmarshal(body, &response)
|
||||
if err != nil {
|
||||
rd.log.Errorf("Error when decoding unrestrict link JSON: %v", err)
|
||||
return nil, err
|
||||
// rd.log.Errorf("Error when decoding unrestrict link JSON: %v", err)
|
||||
return nil, fmt.Errorf("undecodable response so likely it has expired")
|
||||
}
|
||||
|
||||
if !canFetchFirstByte(response.Download) {
|
||||
|
||||
Reference in New Issue
Block a user