Refactor unrestricting
This commit is contained in:
@@ -69,6 +69,10 @@ func (rd *RealDebrid) UnrestrictCheck(link string) (*Download, error) {
|
||||
|
||||
func (rd *RealDebrid) UnrestrictLink(link string, checkFirstByte bool) (*Download, error) {
|
||||
data := url.Values{}
|
||||
if strings.HasPrefix(link, "https://real-debrid.com/d/") {
|
||||
// set link to max 39 chars
|
||||
link = link[0:39]
|
||||
}
|
||||
data.Set("link", link)
|
||||
requestBody := strings.NewReader(data.Encode())
|
||||
|
||||
@@ -106,6 +110,7 @@ func (rd *RealDebrid) UnrestrictLink(link string, checkFirstByte bool) (*Downloa
|
||||
return nil, fmt.Errorf("undecodable response: %v", err)
|
||||
}
|
||||
|
||||
// will only check for first byte if serving from rclone
|
||||
if checkFirstByte && !rd.downloadClient.CanFetchFirstByte(response.Download) {
|
||||
return nil, fmt.Errorf("can't fetch first byte")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user