From edaef750c89b53a760bff65674866f2255bdb0e9 Mon Sep 17 00:00:00 2001 From: plum-pan Date: Sun, 26 Oct 2025 14:26:26 -0400 Subject: [PATCH 1/4] Detect Classic theme and raise error --- faapi/parse.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/faapi/parse.py b/faapi/parse.py index 066d4d3..9a6a8cd 100644 --- a/faapi/parse.py +++ b/faapi/parse.py @@ -27,6 +27,7 @@ from .exceptions import NoTitle from .exceptions import ParsingError from .exceptions import ServerError +from .exceptions import ClassicTheme relative_url: Pattern = re_compile(r"^(?:https?://(?:www\.)?furaffinity\.net)?(.*)") mentions_regexp: Pattern = re_compile(r"^(?:(?:https?://)?(?:www\.)?furaffinity\.net)?/user/([^/#]+).*$") @@ -51,6 +52,8 @@ def parse_page(text: str) -> BeautifulSoup: def check_page_raise(page: BeautifulSoup) -> None: if page is None: raise NonePage + elif 'classic' in page.body['data-static-path']: + raise ClassicTheme elif not (title := page.title.text.lower() if page.title else ""): raise NoTitle elif title.startswith("account disabled"): From 24540173a4f40ec08c4f49c5c4c6ac413371f518 Mon Sep 17 00:00:00 2001 From: plum-pan Date: Sun, 26 Oct 2025 14:26:58 -0400 Subject: [PATCH 2/4] Add exception for Classic theme --- faapi/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/faapi/exceptions.py b/faapi/exceptions.py index 63326cc..39bbddf 100644 --- a/faapi/exceptions.py +++ b/faapi/exceptions.py @@ -51,6 +51,11 @@ class NoticeMessage(ParsingError): A notice of unknown type was found in the page. """ +class ClassicTheme(ParsingError): + """ + The cookies supplied are for an account using the Classic theme. Please change your theme to Modern to use FAAPI. + """ + def _raise_exception(err: BaseException): raise err From 615453ab0ac7e94e433407bd388c2a32ce9b3788 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Wed, 29 Oct 2025 19:25:49 +0100 Subject: [PATCH 3/4] exceptions - fix E302 --- faapi/exceptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/faapi/exceptions.py b/faapi/exceptions.py index 39bbddf..14247b6 100644 --- a/faapi/exceptions.py +++ b/faapi/exceptions.py @@ -51,6 +51,7 @@ class NoticeMessage(ParsingError): A notice of unknown type was found in the page. """ + class ClassicTheme(ParsingError): """ The cookies supplied are for an account using the Classic theme. Please change your theme to Modern to use FAAPI. From 61a3f66e23ddeb67393c0a3c38ce9fa7e2bd51e6 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Wed, 29 Oct 2025 19:28:01 +0100 Subject: [PATCH 4/4] parse:check_page_raise - fix "classic" theme check when body tag does not exist --- faapi/parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faapi/parse.py b/faapi/parse.py index 9a6a8cd..5bdeb2f 100644 --- a/faapi/parse.py +++ b/faapi/parse.py @@ -52,7 +52,7 @@ def parse_page(text: str) -> BeautifulSoup: def check_page_raise(page: BeautifulSoup) -> None: if page is None: raise NonePage - elif 'classic' in page.body['data-static-path']: + elif page.body and "classic" in page.body.attrs.get("data-static-path", ""): raise ClassicTheme elif not (title := page.title.text.lower() if page.title else ""): raise NoTitle