gangsteel

Results 5 comments of gangsteel

Google改变了网页翻译的机制,现在是通过注入js动态翻译页面,所以html中已经没有静态的中文了。想要修复这个问题有两种方式,一种是我们也注入Google的那个js,另一种是使用puppeteer把动态翻译好的dom搞下来。

Puppeteer的话会比较慢,但是处理之后返回的dom里面可以搞到中文的html。 植入Google脚本请参考这里:http://www.fanyigou.com/trans/tranweb.html 。看似简单但是过于依赖Google,随时可能再次break,而且要求客户端client能够科学链接google。 另外要看你的需求,如果只是平常用为什么不直接用Chrome的右键翻译呢?

> 我是需要批量翻译,然后分析数据 那应该只能用Puppeteer或者Selenium等类似的headless browser抓取DOM。否则html里没有中文。

Same here. It stopped working ~1 month ago. Really appreciate it if it could be fixed! Thank you!

> Thank you so much @wuwei-thu !! The yaml file works for me now! Do you want to submit a pull request using your yaml file?