From 2315d1a34cb777f1731368619a4ca14f46125bb4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 14 Mar 2019 12:47:27 +0100 Subject: o Better searching for current currency. --- src/ee/digikey/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ee/digikey') diff --git a/src/ee/digikey/__init__.py b/src/ee/digikey/__init__.py index f67e6b5..d0405f1 100644 --- a/src/ee/digikey/__init__.py +++ b/src/ee/digikey/__init__.py @@ -311,7 +311,12 @@ class DigikeyParser(object): @staticmethod def _find_currency(tree: html) -> Optional[str]: - for e in tree.xpath("//*[@id='cur-dropdown']"): + for e in tree.xpath(".//div[@class='cur-dropdown']/ul"): + s = _clean(e.text) + if s: + return s + + for e in tree.xpath("(//*[@class='locale--lang-cur']/*)[last()]"): s = _clean(e.text) if s: return s -- cgit v1.2.3