fix 2019 parsing
All checks were successful
Build and Publish / build_and_publish (push) Successful in 1m12s
All checks were successful
Build and Publish / build_and_publish (push) Successful in 1m12s
This commit is contained in:
parent
0874ad78e0
commit
b8f73f3bef
1 changed files with 2 additions and 22 deletions
|
@ -128,32 +128,12 @@ class ElectionCog(commands.Cog):
|
||||||
self.log.error("failed to parse %r", span)
|
self.log.error("failed to parse %r", span)
|
||||||
continue
|
continue
|
||||||
results[party] = [seats, change, 0, 0]
|
results[party] = [seats, change, 0, 0]
|
||||||
# if not span:
|
|
||||||
# self.log.warning("%r did not have a 'span' element.", child_ul)
|
|
||||||
# continue
|
|
||||||
|
|
||||||
# text = span.get_text().replace(",", "")
|
|
||||||
# groups = SPAN_REGEX.match(text)
|
|
||||||
# if groups:
|
|
||||||
# groups = groups.groupdict()
|
|
||||||
# else:
|
|
||||||
# self.log.warning(
|
|
||||||
# "Found span element (%r), however resolved text (%r) did not match regex.",
|
|
||||||
# span, text
|
|
||||||
# )
|
|
||||||
# continue
|
|
||||||
|
|
||||||
# results[str(groups["party"]).strip()] = [
|
|
||||||
# int(groups["councillors"].strip()),
|
|
||||||
# int(groups["net"].strip()) * MULTI[groups["net_change"]],
|
|
||||||
# int(find_colour(child_ul.next["class"][0])[1:], base=16)
|
|
||||||
# ]
|
|
||||||
for child_li in good_soups[1].children:
|
for child_li in good_soups[1].children:
|
||||||
span = list(child_li.children)[-1]
|
span = list(child_li.children)[-1]
|
||||||
try:
|
try:
|
||||||
party, extra = span.get_text().strip().split(":", 1)
|
party, extra = span.get_text().strip().split(":", 1)
|
||||||
seats, _ = extra.split(" ", 1)
|
seats, _ = extra.strip().split(" ", 1)
|
||||||
seats = int(seats)
|
seats = int(seats.strip())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log.error("failed to parse %r", span)
|
self.log.error("failed to parse %r", span)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue