From 1d53f5a8bef0b01c1f514b2691538b0ddb3a9e48 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Fri, 25 Feb 2022 15:54:31 +0800 Subject: [PATCH] Work around Cambridge EC dictionary buggy redirects --- .../Models/Dictionaries/CambridgeEnglishChineseDictionary.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/QuickDictionary/Models/Dictionaries/CambridgeEnglishChineseDictionary.cs b/QuickDictionary/Models/Dictionaries/CambridgeEnglishChineseDictionary.cs index 93f94ee..62b7622 100644 --- a/QuickDictionary/Models/Dictionaries/CambridgeEnglishChineseDictionary.cs +++ b/QuickDictionary/Models/Dictionaries/CambridgeEnglishChineseDictionary.cs @@ -15,7 +15,10 @@ public override bool ValidateUrl(string url) => new Uri(url).Host.Trim().ToLower().Contains("cambridge.org"); public override async Task 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 GetWordAsync(ChromiumWebBrowser browser) {