diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-20 18:21:19 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-20 18:21:19 +0200 |
commit | a129c3db44eaab420086c5fd9817ee03f5c26d59 (patch) | |
tree | aab62d50804aef3e5d2a45d5e6eb5c8713ef7c1f /g4f/Provider | |
parent | Improve cli arguments (diff) | |
download | gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar.gz gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar.bz2 gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar.lz gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar.xz gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.tar.zst gpt4free-a129c3db44eaab420086c5fd9817ee03f5c26d59.zip |
Diffstat (limited to 'g4f/Provider')
-rw-r--r-- | g4f/Provider/MetaAI.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/g4f/Provider/MetaAI.py b/g4f/Provider/MetaAI.py index d4cca68d..e64a96d5 100644 --- a/g4f/Provider/MetaAI.py +++ b/g4f/Provider/MetaAI.py @@ -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"), |