mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-22 18:41:20 -07:00
refactor: change data type
This commit is contained in:
parent
aa8b24387a
commit
c794b339fc
@ -62,10 +62,11 @@ func (t *LingvaTranslate) Translate(message string) (translation, definition, pa
|
|||||||
return "", "", "", errors.New("Translation not found")
|
return "", "", "", errors.New("Translation not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = data["pageProps"].(map[string]interface{})
|
||||||
// translation
|
// translation
|
||||||
translation = fmt.Sprintf("%v", data["pageProps"].(map[string]interface{})["translation"])
|
translation = fmt.Sprintf("%v", data["translation"])
|
||||||
// definition
|
// definition
|
||||||
for _, definitions := range data["pageProps"].(map[string]interface{})["info"].(map[string]interface{})["definitions"].([]interface{}) {
|
for _, definitions := range data["info"].(map[string]interface{})["definitions"].([]interface{}) {
|
||||||
definitions := definitions.(map[string]interface{})
|
definitions := definitions.(map[string]interface{})
|
||||||
// part of speech
|
// part of speech
|
||||||
pos := definitions["type"]
|
pos := definitions["type"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user