@@ -73,7 +73,7 @@ def check_page_raise(page: BeautifulSoup) -> None:
7373
7474
7575def username_url (username : str ) -> str :
76- return sub (r"[^a-z\d.~`\[\]-]" , "" , username .lower ())
76+ return sub (r"[^\^ a-z\d.~`\[\]-]" , "" , username .lower ())
7777
7878
7979def inner_html (tag : Tag ) -> str :
@@ -512,8 +512,7 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
512512
513513 tag_category1 : Optional [Tag ] = tag_info .select_one ("span.category-name" )
514514 tag_category2 : Optional [Tag ] = tag_info .select_one ("span.type-name" )
515- tag_species : Optional [Tag ] = (info_spans := tag_info .select ("span" ))[bool (tag_category1 ) + bool (tag_category2 )]
516- tag_gender : Optional [Tag ] = info_spans [1 + bool (tag_category1 ) + bool (tag_category2 )]
515+ tag_species : Optional [Tag ] = tag_info .select ("span" )[bool (tag_category1 ) + bool (tag_category2 )]
517516 tag_description : Optional [Tag ] = sub_page .select_one ("div.submission-description" )
518517 tag_folder : Optional [Tag ] = sub_page .select_one ("a.button[href^='/scraps/'],a.button[href^='/gallery/']" )
519518 tag_file_url : Optional [Tag ] = sub_page .select_one ("div.download a" )
@@ -532,7 +531,6 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
532531 assert tag_type is not None , _raise_exception (ParsingError ("Missing type tag" ))
533532 assert tag_fav is not None , _raise_exception (ParsingError ("Missing fav tag" ))
534533 assert tag_species is not None , _raise_exception (ParsingError ("Missing species tag" ))
535- assert tag_gender is not None , _raise_exception (ParsingError ("Missing gender tag" ))
536534 assert tag_description is not None , _raise_exception (ParsingError ("Missing description tag" ))
537535 assert tag_folder is not None , _raise_exception (ParsingError ("Missing folder tag" ))
538536 assert tag_file_url is not None , _raise_exception (ParsingError ("Missing file URL tag" ))
@@ -556,7 +554,6 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
556554 category += " / " + tag_category2 .text .strip ()
557555 category .strip ()
558556 species : str = tag_species .text .strip ()
559- gender : str = tag_gender .text .strip ()
560557 rating : str = tag_rating .text .strip ()
561558 views : int = int (tag_views .text .strip ())
562559 comment_count : int = int (tag_comment_count .text .strip ())
@@ -577,11 +574,11 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
577574 thumbnail_url = f"{ thumbnail_url .rsplit ('/' , 1 )[0 ]} /{ quote (thumbnail_url .rsplit ('/' , 1 )[1 ])} " \
578575 if thumbnail_url else ""
579576 prev_sub : Optional [int ] = int (
580- get_attr (tag_prev , "href" ).split ("/" )[- 2 ]
581- ) if tag_prev and tag_prev .text .lower () == "prev " else None
577+ get_attr (tag_prev , "href" ).strip ( "/" ). split ("/" )[- 1 ]
578+ ) if tag_prev and tag_prev .text .lower () == "newer " else None
582579 next_sub : Optional [int ] = int (
583- get_attr (tag_next , "href" ).split ("/" )[- 2 ]
584- ) if tag_next and tag_next .text .lower () == "next " else None
580+ get_attr (tag_next , "href" ).strip ( "/" ). split ("/" )[- 1 ]
581+ ) if tag_next and tag_next .text .lower () == "older " else None
585582 fav_link : Optional [str ] = f"{ root } { href } " if (href := get_attr (tag_fav , "href" )).startswith ("/fav/" ) else None
586583 unfav_link : Optional [str ] = f"{ root } { href } " if (href := get_attr (tag_fav , "href" )).startswith ("/unfav/" ) else None
587584 user_folders : list [tuple [str , str , str ]] = []
@@ -605,7 +602,7 @@ def parse_submission_page(sub_page: BeautifulSoup) -> dict[str, Any]:
605602 "tags" : tags ,
606603 "category" : category ,
607604 "species" : species ,
608- "gender" : gender ,
605+ "gender" : None ,
609606 "rating" : rating ,
610607 "views" : views ,
611608 "comment_count" : comment_count ,
0 commit comments