|
|
|
@ -16,14 +16,22 @@ using System.Web;
|
|
|
|
|
|
|
|
|
|
namespace testRjgc.transToNet
|
|
|
|
|
{
|
|
|
|
|
internal class jsonNet : StrToJson
|
|
|
|
|
internal class jsonNet : Messiah
|
|
|
|
|
{
|
|
|
|
|
static string https = "http://api.fanyi.baidu.com/api/trans/vip/translate?";
|
|
|
|
|
|
|
|
|
|
static string appid = "20230925001829663";//20230925001829663,20230923001827495
|
|
|
|
|
static Random rd = new Random();
|
|
|
|
|
static string salt = rd.Next(100000).ToString();
|
|
|
|
|
static string key = "f7ZHpw28izQ1VU_ixoY5";//f7ZHpw28izQ1VU_ixoY5,yjvMNY33Qc1TYSBjTQYQ
|
|
|
|
|
//baidu
|
|
|
|
|
|
|
|
|
|
static string xunweb = "https://itrans.xf-yun.com/v1/its";
|
|
|
|
|
static string xunid = "1299c840";
|
|
|
|
|
static string xunsec = "M2Q4YzkzZTIwZjNkMGE2ZjkwZWMxNzZk";
|
|
|
|
|
static string xunkey = "828cb2dc915d28464a904bda5d7b01b3";
|
|
|
|
|
static string xunfl = "ja";
|
|
|
|
|
static string xundl = "cn";
|
|
|
|
|
static string xuntxt = "白上";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//static HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://api.fanyi.baidu.com/api/trans/vip/translate?q=apple&from=en&to=zh&appid=20230925001829663&salt=1435660288&sign=c963bc2275c0fd1ed30da014c1ef1933");
|
|
|
|
@ -64,7 +72,7 @@ namespace testRjgc.transToNet
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RequestJsonPrivate(string input, string srcl, string dstl, string aid, string kkey)//自定义id,key以及源语言和目标语言
|
|
|
|
|
public string RequestJsonPrivateBaiDu(string input, string srcl, string dstl, string aid, string kkey)//自定义id,key以及源语言和目标语言
|
|
|
|
|
{
|
|
|
|
|
string sign = EncryptString(aid + input + salt + kkey);
|
|
|
|
|
|
|
|
|
@ -89,7 +97,7 @@ namespace testRjgc.transToNet
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RequestJsonLanguageChange(string input, string srcl, string dstl)//可以自定义源语言与目标语言
|
|
|
|
|
public string RequestJsonLanguageChangeBaiDu(string input, string srcl, string dstl)//可以自定义源语言与目标语言
|
|
|
|
|
{
|
|
|
|
|
string sign = EncryptString(appid + input + salt + key);
|
|
|
|
|
|
|
|
|
@ -137,9 +145,22 @@ namespace testRjgc.transToNet
|
|
|
|
|
Trans_result result = temp1.trans_result[0];
|
|
|
|
|
string s = result.dst;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RequestJsonXunFei(string input)
|
|
|
|
|
{
|
|
|
|
|
return "error";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RequestJsonPrivateXunFei(string input, string srcl, string dstl, string xid, string xkey)
|
|
|
|
|
{
|
|
|
|
|
return "error";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RequestJsonLanguageChangeXunFei(string input, string srcl, string dstl)
|
|
|
|
|
{
|
|
|
|
|
return "error";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class Trans_result
|
|
|
|
|
{
|
|
|
|
|