-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
Выбор языка бесполезен
result = await solver.audio(audio_path, lang='ru')
Потому что сам метод audio у вас никуда lang дальше не передаёт...
async def audio(self, file, lang, **kwargs):
async def audio(self, file, lang, **kwargs):
'''Wrapper for solving audio captcha.
Parameters
__________
body : str
Base64 encoded audio file in mp3 format. Max file size: 1 MB.
lang : str
The language of audio record. Supported languages are: "en", "ru", "de", "el", "pt", "fr".
'''
method = "audio"
if not file:
raise ValidationException('File is none')
elif not '.' in file and len(file) > 50:
body = file
elif file.endswith(".mp3") and file.startswith("http"):
async with httpx.AsyncClient(follow_redirects=True) as client:
response = await client.get(file)
if response.status_code != 200:
raise ValidationException(f'File could not be downloaded from url: {file}')
body = b64encode(response.content).decode('utf-8')
elif file.endswith(".mp3"):
async with aiofiles.open(file, "rb") as media:
file_content = await media.read()
body = b64encode(file_content).decode('utf-8')
else:
raise ValidationException('File extension is not .mp3 or it is not a base64 string.')
if not lang or lang not in ("en", "ru", "de", "el", "pt", "fr"):
raise ValidationException(f'Lang not in "en", "ru", "de", "el", "pt", "fr". You send {lang}')
result = await self.solve(body=body, method=method, **kwargs)
return result
по итогу просто всегда ставится английский
{ "captchatype": "solveaudio", "mimetype": "audio/mpeg", "size": 45.63, "lang": "en", "soft_id": 4580 }
Metadata
Metadata
Assignees
Labels
No labels