File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,16 +314,16 @@ def parse_user_page(user_page: BeautifulSoup) -> dict[str, Any]:
314314 info : dict [str , str ] = {}
315315 contacts : dict [str , str ] = {}
316316 for tb in tag_infos :
317- tag_key = tb .select_one ("div" )
318- assert tag_key is not None , assertion_exception ( ParsingError ( "Missing info key tag" ))
319- if "profile-empty" in tb .attrs .get ("class" , []):
317+ if ( tag_key : = tb .select_one ("div" )) is None :
318+ continue
319+ elif "profile-empty" in tb .attrs .get ("class" , []):
320320 continue
321321 elif not (val := [* filter (bool , [c .strip () for c in tb .children if isinstance (c , NavigableString )])][- 1 :]):
322322 continue
323323 info [tag_key .text .strip ()] = val [0 ]
324324 for pc in tag_contacts :
325- tag_key = pc .select_one ("span" )
326- assert tag_key is not None , assertion_exception ( ParsingError ( "Missing contact key tag" ))
325+ if ( tag_key : = pc .select_one ("span" )) is None :
326+ continue
327327 contacts [tag_key .text .strip ()] = a .attrs ["href" ] if (a := pc .select_one ("a" )) else \
328328 [* filter (bool , map (str .strip , pc .text .split ("\n " )))][- 1 ]
329329 user_icon_url : str = "https:" + tag_user_icon_url .attrs ["src" ]
You can’t perform that action at this time.
0 commit comments