diff --git a/.pylintrc b/.pylintrc index c31a651..1285b71 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,3 +10,4 @@ disable= unspecified-encoding, broad-exception-caught, raise-missing-from, + not-a-mapping, diff --git a/artemis/cogs/ocr.py b/artemis/cogs/ocr.py index b3319bf..b3d27eb 100644 --- a/artemis/cogs/ocr.py +++ b/artemis/cogs/ocr.py @@ -87,10 +87,7 @@ class OCR(commands.Cog): async def lens_impl(self, ctx: commands.Context[Artemis], url: str | None) -> str: headers = {"User-Agent": self.bot.user_agent} - cookies = { - "CONSENT": "PENDING+137", - "SOCS": "CAISHAgBEhJnd3NfMjAyMzEwMTItMF9SQzQaAnBsIAEaBgiA48GpBg", - } + cookies = self.bot.keys.google final_data_re = r"\"([\w-]+)\",\[\[(\[\".*?\"\])\]" cur_time = utils.time("ms") diff --git a/artemis/utils/config.py b/artemis/utils/config.py index a5ba6ce..d6aad33 100644 --- a/artemis/utils/config.py +++ b/artemis/utils/config.py @@ -1,7 +1,8 @@ import os -from .common import read_toml from dataclasses import dataclass +from .common import read_toml + @dataclass class Keys: @@ -11,6 +12,7 @@ class Keys: cloudflare: str openai: str deepl: str + google: dict[str, str] @dataclass @@ -31,11 +33,11 @@ class Config: def load_config() -> Config: if os.getenv("ENV") == "production": - config = read_toml("config.prod.toml") + values = read_toml("config.prod.toml") else: - config = read_toml("config.dev.toml") + values = read_toml("config.dev.toml") - return Config(**config) + return Config(**values) config = load_config() diff --git a/config.example.toml b/config.example.toml index 83bf02c..f44bdeb 100644 --- a/config.example.toml +++ b/config.example.toml @@ -13,3 +13,6 @@ catbox = "catbox" github = "github" cloudflare = "cloudflare" openai = "openai" + +# google cookies for lens API +[keys.google]