File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/java/com/airsaid/localization/translate/impl/google Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public class GoogleToken {
3838 private static final int MIM = 60 * 60 * 1000 ;
3939 private static final Random GENERATOR = new Random ();
4040 private static final Pattern TKK_PATTERN = Pattern .compile ("tkk='(\\ d+).(-?\\ d+)'" );
41- private static final String ELEMENT_URL = "https://translate.google.cn /translate_a/element.js" ;
41+ private static final String ELEMENT_URL = "%s /translate_a/element.js" ;
4242
4343 private static Pair <Long , Long > sInnerValue = Pair .create (0L , 0L );
4444 private static boolean sNeedUpdate = true ;
@@ -120,7 +120,9 @@ private static Pair<Long, Long> getDefaultTKK() {
120120
121121 private static Pair <Long , Long > getTKKFromGoogle () {
122122 try {
123- String elementJs = HttpRequests .request (ELEMENT_URL )
123+ String url = String .format (ELEMENT_URL , GoogleTranslator .HOST_URL );
124+ LOG .info ("getTKKFromGoogle url: " + url );
125+ String elementJs = HttpRequests .request (url )
124126 .userAgent (AgentUtil .getUserAgent ())
125127 .tuner (connection -> connection .setRequestProperty ("Referer" , GoogleTranslator .HOST_URL ))
126128 .readString ();
You can’t perform that action at this time.
0 commit comments