fix(search): set user agent for dl
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-13 22:32:16 -04:00
parent d4c8e4d2da
commit 0a1dfeab65
3 changed files with 30 additions and 19 deletions

View File

@@ -17,15 +17,15 @@ func parseAnnasArchiveDownloadURL(body io.ReadCloser) (string, error) {
doc, _ := goquery.NewDocumentFromReader(body)
// Return Download URL
downloadURL, exists := doc.Find("body > table > tbody > tr > td > a").Attr("href")
downloadPath, exists := doc.Find("body > table > tbody > tr > td > a").Attr("href")
if !exists {
return "", fmt.Errorf("Download URL not found")
}
// Possible Funky URL
downloadURL = strings.ReplaceAll(downloadURL, "\\", "/")
downloadPath = strings.ReplaceAll(downloadPath, "\\", "/")
return downloadURL, nil
return fmt.Sprintf("http://libgen.li/%s", downloadPath), nil
}
// getAnnasArchiveBookSelection parses potentially commented out HTML. For some reason