Skip to content

Commit

Permalink
fixed search return items and link
Browse files Browse the repository at this point in the history
  • Loading branch information
HurinHu committed Aug 25, 2023
1 parent f955894 commit 4fdb2be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions GoogleNews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self,lang="en",period="",start="",end="",encode="utf-8",region=None
self.__end = end
self.__encode = encode
self.__exception = False
self.__version = '1.6.9'
self.__version = '1.6.10'

def getVersion(self):
return self.__version
Expand Down Expand Up @@ -143,7 +143,7 @@ def build_response(self):
#TODO might want to add output for user to know no data was found
self.__totalcount = None
logging.debug('Total count is not available when sort by date')
result = self.content.find_all("a",{"jsname" : re.compile(r".*")})[3:-1]
result = self.content.find_all("a",attrs={'data-ved': True})
return result

def page_at(self, page=1):
Expand All @@ -170,7 +170,7 @@ def page_at(self, page=1):
except Exception:
tmp_text = ''
try:
tmp_link = item.get("href")
tmp_link = item.get("href").replace('/url?esrc=s&q=&rct=j&sa=U&url=','')
except Exception:
tmp_link = ''
try:
Expand Down Expand Up @@ -226,7 +226,7 @@ def get_page(self, page=1):
except Exception:
tmp_text = ''
try:
tmp_link = item.get("href")
tmp_link = item.get("href").replace('/url?esrc=s&q=&rct=j&sa=U&url=','')
except Exception:
tmp_link = ''
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="GoogleNews",
version="1.6.9",
version="1.6.10",
author="Hurin Hu",
author_email="hurin@live.ca",
description="Google News search for Python",
Expand Down
2 changes: 1 addition & 1 deletion test/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TestStringMethods(unittest.TestCase):

def testVersion(self):
googlenews = GoogleNews()
version = '1.6.9'
version = '1.6.10'
self.assertIn(version, googlenews.getVersion())
print('Latest version matched')

Expand Down

0 comments on commit 4fdb2be

Please sign in to comment.