Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions faapi/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,11 @@ class NoticeMessage(ParsingError):
"""


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
3 changes: 3 additions & 0 deletions faapi/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/([^/#]+).*$")
Expand All @@ -51,6 +52,8 @@ def parse_page(text: str) -> BeautifulSoup:
def check_page_raise(page: BeautifulSoup) -> None:
if page is None:
raise NonePage
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
elif title.startswith("account disabled"):
Expand Down
Loading