diff --git a/LunaTranslator/LunaTranslator/translator/dev_yandex.py b/LunaTranslator/LunaTranslator/translator/dev_yandex.py index 4369544f..86305cfa 100644 --- a/LunaTranslator/LunaTranslator/translator/dev_yandex.py +++ b/LunaTranslator/LunaTranslator/translator/dev_yandex.py @@ -4,15 +4,13 @@ from translator.basetranslator_dev import basetransdev class TS(basetransdev): target_url = "https://translate.yandex.com/" - def inittranslator(self): - self.last = "" - def translate(self, content): + self.Runtime_evaluate( + 'document.querySelector("#translation > span").innerText=""' + ) self.Runtime_evaluate('document.querySelector("#fakeArea").innerText=""') self.Runtime_evaluate('document.querySelector("#fakeArea").click()') self.send_keys(content) - last = self.wait_for_result( - 'document.querySelector("#translation > span").innerText', self.last + return self.wait_for_result( + 'document.querySelector("#translation > span").innerText' ) - self.last = last - return self.last diff --git a/LunaTranslator/LunaTranslator/translator/google_dev.py b/LunaTranslator/LunaTranslator/translator/google_dev.py index 5022bb88..a86b7f30 100644 --- a/LunaTranslator/LunaTranslator/translator/google_dev.py +++ b/LunaTranslator/LunaTranslator/translator/google_dev.py @@ -8,6 +8,9 @@ class TS(basetransdev): target_url = "https://translate.google.com/" def translate(self, content): + self.Runtime_evaluate( + 'document.querySelector("#yDmH0d > c-wiz > div > div.ToWKne > c-wiz > div.OlSOob > c-wiz > div.ccvoYb > div.AxqVh > div.OPPzxe > c-wiz.sciAJc > div > div.usGWQd > div > div.lRu31").innerText=""' + ) if "lastlang" not in dir(self) or self.lastlang != (self.srclang, self.tgtlang): self.Page_navigate( "https://translate.google.com/?sl={}&tl={}".format( diff --git a/LunaTranslator/LunaTranslator/translator/tx_dev.py b/LunaTranslator/LunaTranslator/translator/tx_dev.py deleted file mode 100644 index 6fcb76d6..00000000 --- a/LunaTranslator/LunaTranslator/translator/tx_dev.py +++ /dev/null @@ -1,45 +0,0 @@ -from translator.basetranslator_dev import basetransdev - - -class TS(basetransdev): - target_url = "https://fanyi.qq.com/" - - def translate(self, content): - tgtlist = [ - "zh", - "en", - "ja", - "ko", - "fr", - "es", - "it", - "de", - "tr", - "ru", - "pt", - "vi", - "id", - "th", - "ms", - "ar", - "hi", - ] - if self.tgtlang in tgtlist: - tgtidx = tgtlist.index(self.srclang) + 1 - else: - tgtidx = 1 - self.Runtime_evaluate( - 'document.querySelector("div.textpanel-tool.tool-close").click()' - ) - self.Runtime_evaluate( - """document.querySelector("#language-button-group-source > div.language-button-dropdown.language-source > ul > li:nth-child(1) > span").click(); - document.querySelector("#language-button-group-target > div.language-button-dropdown.language-target > ul > li:nth-child({}) > span"); - document.getElementsByClassName('textinput')[0].value=`{}`; - document.getElementsByClassName('language-translate-button')[0].click(); - """.format( - tgtidx, content - ) - ) - return self.wait_for_result( - "document.getElementsByClassName('textpanel-target-textblock')[0].innerText" - ) diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index 2dd226f5..505300e0 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -1585,12 +1585,6 @@ "type": "dev", "name": "必应" }, - "tx_dev": { - "use": false, - "color": "blue", - "type": "dev", - "name": "tx" - }, "baidu_dev": { "use": false, "color": "blue",