2626link_content = re .compile (r'>([^<]+)<' )
2727
2828house_regexp = re .compile (r'paid until (.*)' )
29- guild_regexp = re .compile (r'([\s\w()]+)\sof the\s(.+)' )
3029
3130title_regexp = re .compile (r'(.*)\((\d+) titles? unlocked\)' )
3231badge_popup_regexp = re .compile (r"\$\(this\),\s+'([^']+)',\s+'([^']+)'," )
@@ -427,6 +426,12 @@ def _parse_character_information(self, rows):
427426 houses .append ({"id" : int (query ["houseid" ][0 ]), "name" : house_link .text .strip (),
428427 "town" : query ["town" ][0 ], "paid_until" : paid_until_date })
429428 continue
429+ if field == "guild_membership" :
430+ guild_link = cols_raw [1 ].find ('a' )
431+ rank = value .split ("of the" )[0 ]
432+ char ["guild_membership" ] = GuildMembership (guild_link .text , rank .strip ())
433+
434+ continue
430435 if field in int_rows :
431436 value = int (value )
432437 char [field ] = value
@@ -436,9 +441,6 @@ def _parse_character_information(self, rows):
436441 if m :
437442 char ["name" ] = m .group (1 )
438443 char ["deletion_date" ] = parse_tibia_datetime (m .group (2 ))
439- if "guild_membership" in char :
440- m = guild_regexp .match (char ["guild_membership" ])
441- char ["guild_membership" ] = GuildMembership (m .group (2 ), m .group (1 ))
442444
443445 if "(traded)" in char ["name" ]:
444446 char ["name" ] = char ["name" ].replace ("(traded)" ,"" ).strip ()
@@ -682,6 +684,7 @@ class GuildMembership(abc.BaseGuild, abc.Serializable):
682684 The title of the member in the guild.
683685 """
684686 __slots__ = (
687+ "name" ,
685688 "rank" ,
686689 "title" ,
687690 )
0 commit comments