Skip to content

Commit

Permalink
Small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusShepherd committed Dec 1, 2024
1 parent a25ef6d commit 16057c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/board_game_scraper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import logging

logging.getLogger("numba").setLevel(logging.INFO)
logging.getLogger("PIL").setLevel(logging.INFO)
11 changes: 8 additions & 3 deletions src/board_game_scraper/spiders/bgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

class BggSpider(SitemapSpider):
name = "bgg"
allowed_domains = ("boardgamegeek.com",)
allowed_domains = ("boardgamegeek.com", "geekdo-images.com")

# https://boardgamegeek.com/wiki/page/BGG_XML_API2
bgg_xml_api_url = "https://boardgamegeek.com/xmlapi2"
Expand Down Expand Up @@ -352,7 +352,7 @@ def parse_games(
bgg_ids=bgg_ids,
page=page + 1,
priority=-page - 1,
max_page=max_page,
meta={"max_page": max_page},
)

for game in response.xpath("/items/item"):
Expand Down Expand Up @@ -663,8 +663,13 @@ def parse_poll(
if not poll or parse_int_from_elem(poll, "@totalvotes") < self.min_votes:
return default

votes = tuple(parse_votes(poll, attr, enum=enum))

if not votes:
return default

try:
return func(parse_votes(poll, attr, enum=enum))
return func(votes)
except Exception:
self.logger.exception("Error parsing poll <%s>", name)

Expand Down

0 comments on commit 16057c3

Please sign in to comment.