From 940cc8b6233b2a64cffb5d58459975ee61d0a8db Mon Sep 17 00:00:00 2001 From: Moist-Cat Date: Thu, 22 Dec 2022 10:35:38 -0500 Subject: [PATCH] refs #910 --- .gitignore | 4 ++++ app/filter.py | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 02b4e03933..181094f4da 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ dist/ # env whoogle.env + +# vim +*~ +*.swp diff --git a/app/filter.py b/app/filter.py index 92e5a9d35e..1fee1dc828 100644 --- a/app/filter.py +++ b/app/filter.py @@ -610,13 +610,15 @@ def view_image(self, soup) -> BeautifulSoup: # get some tags that are unchanged between mobile and pc versions cor_suggested = soup.find_all('table', attrs={'class': "By0U9"}) - next_pages = soup.find_all('table', attrs={'class': "uZgmoc"})[0] + next_pages = soup.find('table', attrs={'class': "uZgmoc"}) results = [] # find results div - results_div = soup.find_all('div', attrs={'class': "nQvrDb"})[0] - # find all the results - results_all = results_div.find_all('div', attrs={'class': "lIMUZd"}) + results_div = soup.find('div', attrs={'class': "nQvrDb"}) + # find all the results (if any) + results_all = [] + if results_div: + results_all = results_div.find_all('div', attrs={'class': "lIMUZd"}) for item in results_all: urls = item.find('a')['href'].split('&imgrefurl=')