Skip to content

Commit

Permalink
fixed get_news() title and media
Browse files Browse the repository at this point in the history
  • Loading branch information
HurinHu committed Jul 29, 2024
1 parent f2ea55e commit 875b382
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions GoogleNews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ def get_news(self, key="",deamplify=False):
try:
title=article.findAll('div')[2].findAll('a')[0].text
except:
title=None
try:
title=article.findAll('a')[1].text
except:
title=None
# description
try:
desc=None
Expand Down Expand Up @@ -363,7 +366,10 @@ def get_news(self, key="",deamplify=False):
try:
media=article.find("div").findAll("div")[1].find("div").find("div").find("div").text
except:
media=None
try:
media=article.findAll("div")[1].find("div").find("div").find("div").text
except:
media=None
# reporter
try:
reporter = article.findAll('span')[2].text
Expand Down

0 comments on commit 875b382

Please sign in to comment.