@@ -29,6 +29,7 @@ def __init__(self, input_game_name: str, input_game_url: str,
29
29
self .current_entry = None
30
30
self .li_encountered = False
31
31
self .inside_a_div = False
32
+ self .inside_a_strong = False
32
33
self .inside_a_title_link = False
33
34
self .currently_reading = None
34
35
self .game_name = None
@@ -51,6 +52,8 @@ def handle_starttag(self, tag, attrs):
51
52
self .current_entry = HowLongToBeatEntry ()
52
53
53
54
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
54
57
if tag == "a" : # The <a> tag contain the game title and the game page id
55
58
for att in attrs :
56
59
if att [0 ] == "title" : # Read the current game title
@@ -72,6 +75,8 @@ def handle_starttag(self, tag, attrs):
72
75
def handle_endtag (self , tag ):
73
76
if tag == "a" and self .inside_a_title_link : # No longer in the <a> link with the game name
74
77
self .inside_a_title_link = False
78
+ if tag == "strong" and self .inside_a_strong :
79
+ self .inside_a_strong = False
75
80
if tag == "div" : # I save that i'm no longer inside a <div> element
76
81
self .inside_a_div = False
77
82
if tag == "li" and self .li_encountered : # I finished reading the game entry
@@ -97,7 +102,9 @@ def handle_endtag(self, tag):
97
102
# OVERRIDE from HTMLParser
98
103
def handle_data (self , data ):
99
104
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
101
108
if self .inside_a_div :
102
109
# If i'm inside a <div> i must analyze all the possible times, saving title and then his value
103
110
if data .lower ().strip () == "main story" \
0 commit comments