mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-22 15:05:57 +03:00
Add AbraGeoBlockedError handling
This commit is contained in:
parent
e6863a75e1
commit
a129c3db44
@ -18,6 +18,9 @@ class Sources():
|
||||
def __str__(self) -> str:
|
||||
return "\n\n" + ("\n".join([f"[{link['title']}]({link['link']})" for link in self.list]))
|
||||
|
||||
class AbraGeoBlockedError(Exception):
|
||||
pass
|
||||
|
||||
class MetaAI(AsyncGeneratorProvider):
|
||||
url = "https://www.meta.ai"
|
||||
working = True
|
||||
@ -136,6 +139,8 @@ class MetaAI(AsyncGeneratorProvider):
|
||||
async with self.session.get("https://www.meta.ai/", cookies=cookies) as response:
|
||||
await raise_for_status(response, "Fetch home failed")
|
||||
text = await response.text()
|
||||
if "AbraGeoBlockedError" in text:
|
||||
raise AbraGeoBlockedError("Meta AI isn't available yet in your country")
|
||||
if cookies is None:
|
||||
cookies = {
|
||||
"_js_datr": self.extract_value(text, "_js_datr"),
|
||||
|
Loading…
Reference in New Issue
Block a user