|
137 | 137 | tic = time.perf_counter()
|
138 | 138 | if re.search('Passcode', ind_card_info.text):
|
139 | 139 | lists = ind_card_info.find_all("td", class_="cardtablerowdata")
|
140 |
| - passcode = lists[0] |
141 |
| - tmp_card.card_passcode = helpers.cleanStr(passcode.text, [("\n", ""), ("\t", ""), ("\r", "")]) |
| 140 | + if len(lists) != 0: |
| 141 | + passcode = lists[0] |
| 142 | + tmp_card.card_passcode = helpers.cleanStr(passcode.text, [("\n", ""), ("\t", ""), ("\r", "")]) |
142 | 143 |
|
143 | 144 | if re.search('Link Arrows', ind_card_info.text):
|
144 | 145 | lists = ind_card_info.find_all("td", class_="cardtablerowdata")
|
|
152 | 153 |
|
153 | 154 | if re.search('Card effect types', ind_card_info.text):
|
154 | 155 | lists = ind_card_info.find_all("td", class_="cardtablerowdata")
|
155 |
| - card_effect_types = lists[0] |
156 |
| - effect_types = [] |
157 |
| - for effect_type in card_effect_types: |
158 |
| - if not isinstance(effect_type, NavigableString) and effect_type.text != '\n': |
159 |
| - effect_types.append(helpers.cleanStr(effect_type.text, [("\n", "")])) |
160 |
| - tmp_card.effect_types = effect_types |
| 156 | + if len(lists) != 0: |
| 157 | + card_effect_types = lists[0] |
| 158 | + effect_types = [] |
| 159 | + for effect_type in card_effect_types: |
| 160 | + if not isinstance(effect_type, NavigableString) and effect_type.text != '\n': |
| 161 | + for effect in effect_type: |
| 162 | + if effect.text not in effect_types and not re.search('\n', effect.text): |
| 163 | + effect_types.append(effect.text) |
| 164 | + tmp_card.effect_types = effect_types |
161 | 165 |
|
162 | 166 | if re.search('Statuses', ind_card_info.text):
|
163 | 167 | lists = ind_card_info.find_all("td", class_="cardtablerowdata")
|
164 |
| - card_status = lists[0] |
165 |
| - tmp_card.card_status = helpers.cleanStr(card_status.text, [(" ", "")]) |
| 168 | + if len(lists) != 0: |
| 169 | + card_status = lists[0] |
| 170 | + tmp_card.card_status = helpers.cleanStr(card_status.text, [(" ", "")]) |
166 | 171 |
|
167 | 172 | if re.search('Card search categories', ind_card_info.text):
|
168 | 173 | lists = ind_card_info.find_all("div", class_="hlist")
|
|
192 | 197 | tmp_card.card_actions = card_actions
|
193 | 198 |
|
194 | 199 | toc = time.perf_counter()
|
195 |
| - bar.text = f'-> Processing pack: {pack_name}, {tmp_card.name} processed in {toc - tic:0.4f} seconds' |
| 200 | + bar.text = f'-> Processing pack: {pack_name}, {tmp_card.name} processed in {toc - tic:0.4f} seconds' |
196 | 201 |
|
197 | 202 |
|
198 | 203 | # Store the card structure into the list of cards
|
|
0 commit comments