Skip to content

Commit 5a11eef

Browse files
Merge pull request #14 from NietoSkunk/bugfix/submissions-display-names
Change parse_user_header and parse_submission_author to support new FA Display Names
2 parents 5d5b0d9 + a6fd565 commit 5a11eef

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

faapi/parse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,13 @@ def parse_submission_author(author_tag: Tag) -> dict[str, Any]:
455455

456456
assert tag_author is not None, _raise_exception(ParsingError("Missing author tag"))
457457

458-
tag_author_name: Optional[Tag] = tag_author.select_one("a > strong")
458+
tag_author_name: Optional[Tag] = tag_author.select_one("span.c-usernameBlockSimple > a")
459459
tag_author_icon: Optional[Tag] = author_tag.select_one("img.submission-user-icon")
460460

461461
assert tag_author_name is not None, _raise_exception(ParsingError("Missing author name tag"))
462462
assert tag_author_icon is not None, _raise_exception(ParsingError("Missing author icon tag"))
463463

464-
author_name: str = tag_author_name.text.strip()
464+
author_name: str = get_attr(tag_author_name, "href").strip().split('/')[-2]
465465
author_title: str = ([*filter(bool, [child.strip()
466466
for child in tag_author.children
467467
if isinstance(child, NavigableString)][3:])] or [""])[-1]
@@ -609,8 +609,8 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
609609

610610

611611
def parse_user_header(user_header: Tag) -> dict[str, Any]:
612-
tag_status: Optional[Tag] = user_header.select_one("userpage-nav-user-details h1 username")
613-
tag_title_join_date: Optional[Tag] = user_header.select_one("userpage-nav-user-details username.user-title")
612+
tag_status: Optional[Tag] = user_header.select_one("a.c-usernameBlock__userName")
613+
tag_title_join_date: Optional[Tag] = user_header.select_one("userpage-nav-user-details span.user-title")
614614
tag_avatar: Optional[Tag] = user_header.select_one("userpage-nav-avatar img")
615615

616616
assert tag_status is not None, _raise_exception(ParsingError("Missing name tag"))

0 commit comments

Comments
 (0)