Skip to content

Commit

Permalink
Work around Cambridge EC dictionary buggy redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Feb 25, 2022
1 parent 0cd03e3 commit 1d53f5a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public override bool ValidateUrl(string url)
=> new Uri(url).Host.Trim().ToLower().Contains("cambridge.org");

public override async Task<bool> ValidateQueryAsync(string url, string word)
=> !(await WebUtils.GetFinalRedirectAsync(url)).Contains("spellcheck");
{
string finalUrl = await WebUtils.GetFinalRedirectAsync(url);
return !finalUrl.Contains("spellcheck") && !finalUrl.EndsWith("english-chinese-traditional/");
}

public override async Task<string> GetWordAsync(ChromiumWebBrowser browser)
{
Expand Down

0 comments on commit 1d53f5a

Please sign in to comment.