This commit is contained in:
恍兮惚兮 2024-05-02 21:23:27 +08:00
parent 753a6fc591
commit 97c5ec3c83

View File

@ -67,10 +67,6 @@ class BaiduV1(Tse):
super().__init__() super().__init__()
self.host_url = "https://fanyi.baidu.com" self.host_url = "https://fanyi.baidu.com"
self.api_url = "https://fanyi.baidu.com/transapi" self.api_url = "https://fanyi.baidu.com/transapi"
self.get_lang_url = None
self.get_lang_url_pattern = (
"https://fanyi-cdn.cdn.bcebos.com/webStatic/translation/js/index.(.*?).js"
)
self.host_headers = self.get_headers(self.host_url, if_api=False) self.host_headers = self.get_headers(self.host_url, if_api=False)
self.api_headers = self.get_headers(self.host_url, if_api=True) self.api_headers = self.get_headers(self.host_url, if_api=True)
self.language_map = None self.language_map = None
@ -144,11 +140,6 @@ class BaiduV1(Tse):
).text ).text
# self.language_map = self.get_language_map(host_html, from_language=from_language, to_language=to_language) # self.language_map = self.get_language_map(host_html, from_language=from_language, to_language=to_language)
if not self.get_lang_url:
self.get_lang_url = (
re.compile(self.get_lang_url_pattern).search(host_html).group()
)
form_data = { form_data = {
"from": from_language, "from": from_language,
"to": to_language, "to": to_language,