Change author search URL to Kindle only.
MODIFY
XRayBuilder.Core/src/DataSources/Amazon/AmazonClient.cs
XRayBuilder.Core/src/DataSources/Amazon/AmazonClient.cs
@@ -66,11 +66,15 @@ public async Task<AuthorSearchResults> SearchAuthor(string author, string TLD, C
var plusAuthorName = newAuthor.Replace(" ", "+");
//Updated to match Search "all" Amazon
var amazonAuthorSearchUrl = $"https://www.amazon.{TLD}/s/ref=nb_sb_noss_2?url=search-alias%3Dstripbooks&field-keywords={plusAuthorName}";
+
+ // Changed to Amazon Kindle store only search
+ var amazonKindleAuthorSearchUrl = $"https://www.amazon.{TLD}/s?k={plusAuthorName}&i=digital-text&ref=nb_sb_noss";
+
if(enableLog)
_logger.Log($"Searching for author's page on Amazon.{TLD}...");
// Search Amazon for Author
- var authorSearchDoc = await _httpClient.GetPageAsync(amazonAuthorSearchUrl, cancellationToken);
+ var authorSearchDoc = await _httpClient.GetPageAsync(amazonKindleAuthorSearchUrl, cancellationToken);
// Check for captcha
try
@@ -240,7 +244,7 @@ private List<BookInfo> GetAuthorBooksNew(HtmlDocument authorHtmlDoc, string auth
continue;
var bookNodes = result.SelectNodes(".//div[@class='a-fixed-right-grid-inner']/div/div")
?? throw new FormatChangedException(nameof(AmazonClient), "book results - title nodes");
- var name = bookNodes.FirstOrDefault()?.SelectSingleNode("./a")?.InnerText.Trim()
+ var name = HtmlEntity.DeEntitize(bookNodes.FirstOrDefault()?.SelectSingleNode("./a")?.InnerText.Trim())
?? throw new FormatChangedException(nameof(AmazonClient), "book results - title");
// Skip known-bad things like lists and series and stuff
@@ -282,7 +286,7 @@ private List<BookInfo> GetAuthorBooks(HtmlDocument authorHtmlDoc, string author,
// Skip known-bad things like lists and series and stuff
if (_regexIgnoreHeaders.IsMatch(otherBook.InnerText))
continue;
- var name = otherBook.InnerText.Trim().ToTitleCase();
+ var name = HtmlEntity.DeEntitize(otherBook.InnerText.Trim().ToTitleCase());
otherBook = result.SelectSingleNode(".//*[@title='Kindle Edition']");
if (otherBook == null)
continue;

- Change author search URL to Kindle only.