fjqingyou/PotPlayer_Subtitle_Translate_Baidu

能否制作免api版

aclihub opened this issue · 6 comments

在potplayer中的谷歌翻译,api里填

http://translate.google.cn/translate_a/single?client=gtx&sl=en&tl=zh-CN&dt=t&q=

就可以实现翻译各种语言,实测,不过测试时必须填英文
百度翻译能否实现这样的功能呢

我尝试过了。也成功了。但是不合适

因为我自己试用了几分钟,报错了。查看错误原因,被谷歌翻译判定为频繁访问翻译的攻击。。。无奈的是。字幕是一句话翻译一次,两句话之间的间隔可能很短,,持续几次就被谷歌翻译拦截掉,

哪怕我设置了每一句翻译后间隔4秒钟才翻译下一句。。大约翻译了40句左右。。又封禁了。。。

经常被封禁了翻译。。所以我暂时放弃了谷歌翻译了

出错时,服务器不给json内容了。会得到下面的结果。。你可以复制保存问html文件,用浏览器查看它

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=auto&amp;tl=ja&amp;dt=t&amp;q=%E6%84%8F%E5%91%B3%E3%81%8C%E7%84%A1%E3%81%84</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
<hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>
<div style="font-size:13px;">
Our systems have detected unusual traffic from your computer network.  Please try your request again later.  <a href="#" onclick="document.getElementById('infoDiv0').style.display='block';">Why did this happen?</a><br><br>
<div id="infoDiv0" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href="//www.google.com/policies/terms/">Terms of Service</a>. The block will expire shortly after those requests stop.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests.  If you share your network connection, ask your administrator for help &mdash; a different computer using the same IP address may be responsible.  <a href="//support.google.com/websearch/answer/86640">Learn more</a><br><br>Sometimes you may see this page if you are using advanced terms that robots are known to use, or sending requests very quickly.
</div><br>

IP address: 这里是IP地址,我就抹除了<br>Time: 2020-02-14T09:26:39Z<br>URL: https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=auto&amp;tl=ja&amp;dt=t&amp;q=%E6%84%8F%E5%91%B3%E3%81%8C%E7%84%A1%E3%81%84<br>
</div>
</div>
</body>
</html>

@aclihub 想到了可变json可能,测试后修改方案后可行了。为了统一管理,发布成了新git。
地址是 https://github.com/fjqingyou/PotPlayer_Subtitle_Translate_Google_Single

我去。。。。抱歉抱歉,一不小心看错了你要表达的东东了。。

汗。。百度方面之前没注意到有类似功能的消息。。。

goole 那个url下线了

能否开发一个有道翻译的版本的potplayer翻译引擎呢?