@@ -29,6 +29,7 @@ def __init__(self, input_game_name: str, input_game_url: str,
2929 self .current_entry = None
3030 self .li_encountered = False
3131 self .inside_a_div = False
32+ self .inside_a_strong = False
3233 self .inside_a_title_link = False
3334 self .currently_reading = None
3435 self .game_name = None
@@ -51,6 +52,8 @@ def handle_starttag(self, tag, attrs):
5152 self .current_entry = HowLongToBeatEntry ()
5253
5354 if self .li_encountered : # If i already read the <li> tag i'm inside a game entry
55+ if tag == "strong" :
56+ self .inside_a_strong = True
5457 if tag == "a" : # The <a> tag contain the game title and the game page id
5558 for att in attrs :
5659 if att [0 ] == "title" : # Read the current game title
@@ -72,6 +75,8 @@ def handle_starttag(self, tag, attrs):
7275 def handle_endtag (self , tag ):
7376 if tag == "a" and self .inside_a_title_link : # No longer in the <a> link with the game name
7477 self .inside_a_title_link = False
78+ if tag == "strong" and self .inside_a_strong :
79+ self .inside_a_strong = False
7580 if tag == "div" : # I save that i'm no longer inside a <div> element
7681 self .inside_a_div = False
7782 if tag == "li" and self .li_encountered : # I finished reading the game entry
@@ -97,7 +102,9 @@ def handle_endtag(self, tag):
97102 # OVERRIDE from HTMLParser
98103 def handle_data (self , data ):
99104 if self .inside_a_title_link and len (data .strip ()) > 0 :
100- self .current_entry .game_name = data .strip ()
105+ self .current_entry .game_name = data .strip () # Save the title of the game
106+ if self .inside_a_strong and len (data .strip ()) > 0 :
107+ self .current_entry .game_name_suffix = data .strip () # Save the suffix of the game
101108 if self .inside_a_div :
102109 # If i'm inside a <div> i must analyze all the possible times, saving title and then his value
103110 if data .lower ().strip () == "main story" \
0 commit comments