From bd33b778f17e5751a14160baeae6cdcd41ce1ca7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 15 Aug 2019 12:01:17 +0200 Subject: datasheet: wip --- src/ee/digikey/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ee/digikey/__init__.py') diff --git a/src/ee/digikey/__init__.py b/src/ee/digikey/__init__.py index 15eb5e6..b46ba85 100644 --- a/src/ee/digikey/__init__.py +++ b/src/ee/digikey/__init__.py @@ -126,8 +126,9 @@ class PriceBreak(object): class Document(object): - def __init__(self, kind: str, title: str, url: str): - self.kind = kind + def __init__(self, section: str, classes: List[str], title: str, url: str): + self.section = section + self.classes = classes self.title = title self.url = url @@ -464,7 +465,9 @@ class DigikeyParser(object): if href.startswith("//"): href = "https:" + href - docs.append(Document(kind, title, href)) + classes = [cls[3:].lower() for cls in a.get("class", "").split(" ") if cls.startswith("lnk")] + + docs.append(Document(kind, classes, title, href)) return docs -- cgit v1.2.3