diff --git a/GoogleNews/__init__.py b/GoogleNews/__init__.py index 706fd7c..5cdf385 100644 --- a/GoogleNews/__init__.py +++ b/GoogleNews/__init__.py @@ -79,7 +79,7 @@ def __init__(self,lang="en",period="",start="",end="",encode="utf-8",region=None self.__start = start self.__end = end self.__encode = encode - self.__version = '1.6.4' + self.__version = '1.6.5' def getVersion(self): return self.__version @@ -136,7 +136,7 @@ def build_response(self): else: #TODO might want to add output for user to know no data was found return - result = self.content.find_all("div", id="search")[0].find("div", id="rso").children + result = self.content.find_all("a",{"jsname" : re.compile(r".*")})[3:-1] return result def page_at(self, page=1): @@ -164,7 +164,7 @@ def page_at(self, page=1): except Exception: tmp_text = '' try: - tmp_link = item.find("a").get("href") + tmp_link = item.get("href") except Exception: tmp_link = '' try: @@ -218,7 +218,7 @@ def get_page(self, page=1): except Exception: tmp_text = '' try: - tmp_link = item.find("a").get("href") + tmp_link = item.get("href") except Exception: tmp_link = '' try: diff --git a/setup.py b/setup.py index 95e0de7..7c05fa3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="GoogleNews", - version="1.6.4", + version="1.6.5", author="Hurin Hu", author_email="hurin@live.ca", description="Google News search for Python", diff --git a/test/test_search.py b/test/test_search.py index 20082ec..b548fce 100644 --- a/test/test_search.py +++ b/test/test_search.py @@ -51,7 +51,7 @@ class TestStringMethods(unittest.TestCase): def testVersion(self): googlenews = GoogleNews() - version = '1.6.4' + version = '1.6.5' self.assertIn(version, googlenews.getVersion()) print('Latest version matched')