fix(inst): prefix LEGO.com instruction filenames with the set number (#171)

This commit is contained in:
2026-07-15 00:41:53 +02:00
parent 2a571edb57
commit f46f13343d
+6 -1
View File
@@ -300,7 +300,12 @@ class BrickInstructions(object):
if label is None or link is None or not link.get('href'):
continue
slug = re.sub(r'[^A-Za-z0-9]+', '-', label.get_text(strip=True)).strip('-') # noqa: E501
# Prefix with the set number: filenames are how a downloaded
# instruction later gets matched back to its set (see
# BrickInstructions.__init__), and LEGO's own card labels never
# mention the set number, only the product name and booklet.
card_slug = re.sub(r'[^A-Za-z0-9]+', '-', label.get_text(strip=True)).strip('-') # noqa: E501
slug = f'{set}-{card_slug}'
download_url = urljoin('https://www.lego.com', link['href'])
logger.debug(f"[find_instructions] Found download link: {download_url}") # noqa: E501