Manga search provider updates.
This commit is contained in:
@@ -4,8 +4,14 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace MangaReader.Core.Search.MangaDex;
|
||||
|
||||
public class MangaDexSearchProvider(IHttpService httpService) : MangaSearchProviderBase<MangaDexSearchResult>(httpService)
|
||||
public partial class MangaDexSearchProvider(IHttpService httpService) : MangaSearchProviderBase<MangaDexSearchResult>(httpService)
|
||||
{
|
||||
[GeneratedRegex(@"[^a-z0-9\s-]")]
|
||||
private static partial Regex InvalidSlugCharactersRegex();
|
||||
|
||||
[GeneratedRegex(@"\s+")]
|
||||
private static partial Regex WhitespaceRegex();
|
||||
|
||||
protected override string GetSearchUrl(string keyword)
|
||||
{
|
||||
string normalizedKeyword = keyword.ToLowerInvariant().Normalize(NormalizationForm.FormD);
|
||||
@@ -41,9 +47,9 @@ public class MangaDexSearchProvider(IHttpService httpService) : MangaSearchProvi
|
||||
// title.ToLowerInvariant().Normalize(NormalizationForm.FormD);
|
||||
|
||||
title = title.ToLowerInvariant();
|
||||
//title = Regex.Replace(title, @"[^a-z0-9\s-]", ""); // remove invalid chars
|
||||
title = Regex.Replace(title, @"[^a-z0-9\s-]", "-"); // replace invalid chars with dash
|
||||
title = Regex.Replace(title, @"\s+", "-"); // replace spaces with dash
|
||||
//title = InvalidSlugCharactersRegex().Replace(title, ""); // remove invalid chars
|
||||
title = InvalidSlugCharactersRegex().Replace(title, "-"); // replace invalid chars with dash
|
||||
title = WhitespaceRegex().Replace(title, "-"); // replace spaces with dash
|
||||
|
||||
return title.Trim('-');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user