Skip to content

Commit 002128d

Browse files
authored
Fix some vaild lang_result that get incorrectly fallbacked
1 parent bfca3eb commit 002128d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/yagooglesearch/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ def __init__(
144144
self.query = urllib.parse.quote_plus(query)
145145
self.tld = tld
146146
self.lang_html_ui = lang_html_ui
147-
self.lang_result = lang_result.lower()
147+
self.lang_result = (
148+
lang_result.lower()
149+
if "-" not in lang_result
150+
else f"{lang_result.split('-')[0].lower()}-{lang_result.split('-')[1].upper()}"
151+
)
148152
self.tbs = tbs
149153
self.safe = safe
150154
self.start = start

0 commit comments

Comments
 (0)