Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIY another easy "fix" to empty list issue #101

Open
GordonRamsay-689 opened this issue Nov 9, 2024 · 0 comments
Open

FIY another easy "fix" to empty list issue #101

GordonRamsay-689 opened this issue Nov 9, 2024 · 0 comments

Comments

@GordonRamsay-689
Copy link

GordonRamsay-689 commented Nov 9, 2024

First of all, make sure you have the correct version of bs4 installed.

You can run the following commands at your own risk if you want to completely uninstall old versions and install bs4 for python3:

$ pip uninstall beautifulsoup4
$ pip3 uninstall beautifulsoup4   
$ pip uninstall BeautifulSoup
$ pip3 uninstall BeautifulSoup
$ pip3 install beautifulsoup4

Now, this did NOT fix the empty list issue for me, but this is important first step in case you have accidentally installed the wrong version. The reason was because the description would always be None, and thus the check in modules/standard_search.py would always be true, and thus not append to results.

in 'modules/standard_search.py' on line 96:

if void is True:
    if res.description is None:
        continue

This check can prevent empty results being added, but as soon as the description parsing function is no longer current this will mess everything up, leaving you with an empty list.

I replaced it with a simpler check (which you should really expand upon if you want to avoid unpopulated responses):

if res is None:
    continue
if res.description is None: # Optional
    res.description = "No description" 

Obviously this does not fix the function to get the description, but it does make sure you can get links, title etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant