Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代理问题 #186

Closed
ainy0315 opened this issue Dec 16, 2021 · 6 comments
Closed

代理问题 #186

ainy0315 opened this issue Dec 16, 2021 · 6 comments

Comments

@ainy0315
Copy link

解决了,我用sstap挂了全局代理就好了 V2RAYN和clash都不能解决这个问题 我用终端命令也是这样 测试能访问谷歌,但是无法识别。翻译现在是报这种错误
autosub -S ja-jp -i "C:\Users\Administrator\Downloads\LANREN\LANREN.mp4" -D zh-cn
然后语音识别100%后报这个
语音转文字中: 100% |#########################################################################################| Time: 0:01:28
Traceback (most recent call last):
File "C:\Python39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Python39\Scripts\autosub.exe_main
.py", line 7, in
File "C:\Python39\lib\site-packages\autosub_init
.py", line 166, in main
cmdline_utils.audio_or_video_prcs(args,
File "C:\Python39\lib\site-packages\autosub\cmdline_utils.py", line 1614, in audio_or_video_prcs
translated_text, args.src_language = core.list_to_googletrans(
File "C:\Python39\lib\site-packages\autosub\core.py", line 772, in list_to_googletrans
result_src = translator.detect(content_to_trans).lang
File "C:\Python39\lib\site-packages\googletrans\client.py", line 369, in detect
translated = self.translate(text, src='auto', dest='en')
File "C:\Python39\lib\site-packages\googletrans\client.py", line 219, in translate
parsed = json.loads(data[0][2])
File "C:\Python39\lib\json_init
.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
还是跟以前提到的issues

Originally posted by @ainy0315 in #185 (comment)

@ainy0315
Copy link
Author

我看之前 说安装googletrans4.0.0rc1s ,最新分支应该是配了这个的,但还是报错,这个是不是因为googletans的免费API不能用了 需要设置自己的googletrans api呢

@ainy0315
Copy link
Author

还是说谷歌翻译只能使用http代理 即使像ssr ss这种能正常使用googlespeech的也不行

@ainy0315
Copy link
Author

但是我看readme提到可以使用SS

@ainy0315
Copy link
Author

Traceback (most recent call last):
File "C:\Python39\lib\site-packages\googletrans\gtoken.py", line 63, in _update
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Python39\Scripts\autosub.exe_main
.py", line 7, in
File "C:\Python39\lib\site-packages\autosub_init
.py", line 166, in main
cmdline_utils.audio_or_video_prcs(args,
File "C:\Python39\lib\site-packages\autosub\cmdline_utils.py", line 1614, in audio_or_video_prcs
translated_text, args.src_language = core.list_to_googletrans(
File "C:\Python39\lib\site-packages\autosub\core.py", line 772, in list_to_googletrans
result_src = translator.detect(content_to_trans).lang
File "C:\Python39\lib\site-packages\googletrans\client.py", line 285, in detect
data, response = self._translate(text, 'en', 'auto', kwargs)
File "C:\Python39\lib\site-packages\googletrans\client.py", line 102, in _translate
token = self.token_acquirer.do(text)
File "C:\Python39\lib\site-packages\googletrans\gtoken.py", line 199, in do
self._update()
File "C:\Python39\lib\site-packages\googletrans\gtoken.py", line 67, in _update
raise Exception('Could not find TKK token for this request.\nSee ssut/py-googletrans#234 for more details.')
Exception: Could not find TKK token for this request.
See ssut/py-googletrans#234 for more details.
我参照你的指引把Googletrans替换成 googletrans 3.1.0a0. 输入以上指令出来这个

@ainy0315 ainy0315 reopened this Dec 17, 2021
@ainy0315
Copy link
Author

解决了,我用sstap挂了全局代理就好了 V2RAYN和clash都不能解决这个问题 我用终端命令也是这样 测试能访问谷歌,但是无法识别。翻译现在是报这种错误 autosub -S ja-jp -i "C:\Users\Administrator\Downloads\LANREN\LANREN.mp4" -D zh-cn 然后语音识别100%后报这个 语音转文字中: 100% |#########################################################################################| Time: 0:01:28 Traceback (most recent call last): File "C:\Python39\lib\runpy.py", line 197, in run_module_as_main return run_code(code, main_globals, None, File "C:\Python39\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "C:\Python39\Scripts\autosub.exe__main.py", line 7, in File "C:\Python39\lib\site-packages\autosub__init_.py", line 166, in main cmdline_utils.audio_or_video_prcs(args, File "C:\Python39\lib\site-packages\autosub\cmdline_utils.py", line 1614, in audio_or_video_prcs translated_text, args.src_language = core.list_to_googletrans( File "C:\Python39\lib\site-packages\autosub\core.py", line 772, in list_to_googletrans result_src = translator.detect(content_to_trans).lang File "C:\Python39\lib\site-packages\googletrans\client.py", line 369, in detect translated = self.translate(text, src='auto', dest='en') File "C:\Python39\lib\site-packages\googletrans\client.py", line 219, in translate parsed = json.loads(data[0][2]) File "C:\Python39\lib\json__init__.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType 还是跟以前提到的issues

Originally posted by @ainy0315 in #185 (comment)

翻译报错问题也解决了,目前可以确认的是最新DEV语音识别和googletrans都没有问题,导致上述问题出现有三个原因,一是没有使用正确的代理方式,二是缺少相应的python环境 三是autosub缺少参数
代理方式:我试过设置终端代理加本地VPN 终端代理+clash 终端代理+v2rayN,不知道是不是因为设置方式的问题,在通过curl www.google.com测试后,语音识别始终仍然只出时间轴,更别提翻译了
环境问题:为什么说环境问题呢 因为我在使用SubtitleTranslator(https://github.com/ainy0315/SubtitleTranslator)这个同样使用googletrans 4.0.0rc1的工具的时候发现这个程序能够正常运行,也就是说googletrans 4.0.0rc1能够正常运行。但是我之前使用googletrans明显会报上述错误,所以我赶紧打开autosub!!!发现竟然能够i正常使用了!!!!为什么会这样呢 ,我想应该是安装SubtitleTranslator时会先安装它的支持环境,而他的支持环境正好是googletrans能够正常运行的环境,所以只需要看看他的requirements然后安装环境就可以了
参数问题:在安装SubtitleTranslator发现googletrans能够正常使用后,我使用-S ja-jp -i "C:\Users\Administrator\Downloads\LANREN\LANREN.mp4" -D zh-cn在最后翻译的时候闪退,后来我又使用-S ja-jp -i "C:\Users\Administrator\Downloads\LANREN\LANREN.mp4" -SRC ja -D zh-cn 发现能够正常翻译了

@BingLingGroup
Copy link
Owner

使用代理的方法请查看help信息中-hsp相关选项的说明,目前只支持http代理。
请先查看help信息和readme,我写得已经很全面了。

@BingLingGroup BingLingGroup changed the title 解决了,我用sstap挂了全局代理就好了 V2RAYN和clash都不能解决这个问题 我用终端命令也是这样 测试能访问谷歌,但是无法识别。翻译现在是报这种错误 代理问题 Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants