Skip to content

Commit

Permalink
perf: replace mm_urlencode with system url encode
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Dec 16, 2023
1 parent c77997f commit 0bb80a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Easydict/Feature/Service/Baidu/EZBaiduTranslate.m
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ - (NSString *)getAudioURLWithText:(NSString *)text langCode:(NSString *)ttsLangC
*/

text = [text trimToMaxLength:1000];
text = [text mm_urlencode]; // text.mm_urlencode
text = [text encode]; // text.mm_urlencode

// Refer to Baidu web.
NSInteger speed = [ttsLangCode isEqualToString:@"zh"] ? 5 : 3;
Expand All @@ -343,7 +343,7 @@ - (NSString *)getAudioURLWithText:(NSString *)text langCode:(NSString *)ttsLangC
// */
//
// text = [text trimToMaxLength:1000];
// text = [text mm_urlencode]; // text.mm_urlencode
// text = [text encode]; // text.mm_urlencode
//
// NSString *ttsLangCode = [self getTTSLanguageCode:language];
//
Expand Down
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Google/EZGoogleTranslate.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ - (NSString *)getAudioURLWithText:(NSString *)text
NSString *audioURL = [NSString stringWithFormat:@"%@/"
@"translate_tts?ie=UTF-8&q=%@&tl=%@&total=1&idx=0&"
@"textlen=%zd&tk=%@&client=webapp&prev=input",
kGoogleTranslateURL, text.mm_urlencode, language,
kGoogleTranslateURL, text.encode, language,
text.length, sign];
return audioURL;
}
Expand Down
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Youdao/EZYoudaoTranslate.m
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ - (void)textToAudio:(NSString *)text fromLanguage:(EZLanguage)from completion:(v
NSString *language = [self getTTSLanguageCode:from];

// text = [text trimToMaxLength:1000];
text = [text mm_urlencode]; // text.mm_urlencode
text = [text encode]; // text.mm_urlencode

NSString *audioURL = [NSString stringWithFormat:@"%@/dictvoice?audio=%@&le=%@", kYoudaoDictURL, text, language];
// audioURL = [NSString stringWithFormat:@"https://fanyi.sogou.com/reventondc/synthesis?text=%@&speed=1&lang=%@&from=translateweb&speaker=6", text, language];
Expand Down

0 comments on commit 0bb80a0

Please sign in to comment.