| 200 | lang_map = {"zh": "zh-Hans"} |
| 201 | |
| 202 | def __init__(self, lang_in, lang_out, model, ignore_cache=False, **kwargs): |
| 203 | super().__init__(lang_in, lang_out, model, ignore_cache) |
| 204 | self.session = requests.Session() |
| 205 | self.endpoint = "https://www.bing.com/translator" |
| 206 | self.headers = { |
| 207 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", # noqa: E501 |
| 208 | } |
| 209 | |
| 210 | def find_sid(self): |
| 211 | response = self.session.get(self.endpoint) |