Fix nosalty tag extraction: scope to recipe attribute list
The m-tags__tagItem class is used site-wide for SEO/navigation links. Scope tag extraction to div.p-recipe__attributeList to only get actual recipe tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -354,8 +354,11 @@ def _parse_nosalty(soup: BeautifulSoup, url: str) -> dict:
|
|||||||
instructions.append(txt)
|
instructions.append(txt)
|
||||||
|
|
||||||
# --- Tags ---
|
# --- Tags ---
|
||||||
|
# Scoped to div.p-recipe__attributeList to avoid site-wide SEO tags.
|
||||||
tags = []
|
tags = []
|
||||||
for a in soup.find_all("a", class_="m-tags__tagItem"):
|
attr_list = soup.find("div", class_="p-recipe__attributeList")
|
||||||
|
if attr_list:
|
||||||
|
for a in attr_list.find_all("a", class_="m-tags__tagItem"):
|
||||||
tag_text = a.get_text(strip=True)
|
tag_text = a.get_text(strip=True)
|
||||||
if tag_text:
|
if tag_text:
|
||||||
tags.append(tag_text)
|
tags.append(tag_text)
|
||||||
|
|||||||
Reference in New Issue
Block a user