Added Russian-language specific optimization
This commit is contained in:
parent
9b1a7260f1
commit
f1a5d1b7c5
1 changed files with 11 additions and 2 deletions
|
|
@ -19,10 +19,19 @@ func GetNameByCardId(set string, number string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOriginalName(name string) string {
|
func GetOriginalName(name string) string {
|
||||||
path := SCRYFALL_URL + "/cards/named?fuzzy=" + url.QueryEscape(name)
|
path := SCRYFALL_URL + "/cards/named?fuzzy=" + ApplyFilters(name)
|
||||||
return GetCardByUrl(path)
|
return GetCardByUrl(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ApplyFilters(name string) string {
|
||||||
|
/*
|
||||||
|
Despite of the rules of Russian language, letter ё is replaced with e on cards
|
||||||
|
Sometimes it leads to wrong search results
|
||||||
|
*/
|
||||||
|
name = strings.ReplaceAll(name, "ё", "е")
|
||||||
|
return url.QueryEscape(name)
|
||||||
|
}
|
||||||
|
|
||||||
func GetCardByUrl(path string) string {
|
func GetCardByUrl(path string) string {
|
||||||
response, err := http.Get(path)
|
response, err := http.Get(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue