Skip to content

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

@GordonRamsay-689

Description

@GordonRamsay-689

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions