Changeset 20 in code for trunk/engines/iciba.go


Ignore:
Timestamp:
Aug 31, 2023, 8:28:02 AM (22 months ago)
Author:
manerakai
Message:

Improved code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/engines/iciba.go

    r15 r20  
    226226
    227227func (_ *ICIBA) Translate(text string, from, to string) (TranslationResult, error) {
    228         requestURL, err := url.Parse("https://ifanyi.iciba.com/index.php")
    229 
    230         if err != nil {
    231                 // The URL is constant, so it should never fail.
    232                 panic(err)
    233         }
     228        requestURL, _ := url.Parse("https://ifanyi.iciba.com/index.php")
    234229
    235230        query := url.Values{}
     
    240235
    241236        sum := md5.Sum([]byte(("6key_web_fanyiifanyiweb8hc9s98e" + text)))
    242 
    243237        query.Add("sign", hex.EncodeToString(sum[:])[:16])
    244238
     
    251245
    252246        response, err := http.PostForm(requestURL.String(), formData)
    253 
    254247        if err != nil {
    255248                return TranslationResult{}, err
     
    287280        }, nil
    288281}
     282
     283func (_ *ICIBA) Tts(text, lang string) (string, error) { return "", nil }
Note: See TracChangeset for help on using the changeset viewer.