更新拼音api的解析
This commit is contained in:
parent
1b61722446
commit
3f88a20557
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class ToolsApplication {
|
public class ToolsApplication {
|
||||||
public static final String version="1.5.0";
|
public static final String version="1.5.1";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("当前版本号:" + version);
|
System.out.println("当前版本号:" + version);
|
||||||
|
@ -462,7 +462,7 @@ public class Tools {
|
|||||||
String pinyin = HttpTools.get("https://apis.tianapi.com/pinyin/index?key=" + ConfigTools.load(ConfigTools.CONFIG, "tianapi.key", String.class) + "&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8));
|
String pinyin = HttpTools.get("https://apis.tianapi.com/pinyin/index?key=" + ConfigTools.load(ConfigTools.CONFIG, "tianapi.key", String.class) + "&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8));
|
||||||
JSONObject json = JSONObject.parseObject(pinyin);
|
JSONObject json = JSONObject.parseObject(pinyin);
|
||||||
if (json.getInteger("code") == 200) {
|
if (json.getInteger("code") == 200) {
|
||||||
return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", "");
|
return json.getJSONObject("result").getString("pinyin").trim().replace(" ", "");
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -488,4 +488,8 @@ public class Tools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(getPinYin("你好"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user