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

KeyError 'href' #10

Open
Luqmanakim opened this issue Dec 29, 2020 · 3 comments
Open

KeyError 'href' #10

Luqmanakim opened this issue Dec 29, 2020 · 3 comments

Comments

@Luqmanakim
Copy link

Hi,

I tried running the script (in Python 3) however I encountered an issue at line 39 (lambda x: x.attrs['href'].startswith('http://www.vgchartz.com/game/') ) which resulted in a KeyError 'href'.

Kindly advice what is needed to solve this?

Many thanks!

@rodri270
Copy link

I also had the same issue. Kinda curious if theres a fix. I've tried a few different scripts now and still nothing

@programista10kpln
Copy link

Fix this man, pls.

@bomxacalaka
Copy link

Fix this man, pls.
Found a quick fix from someone on the pull request page, replace your lambda function with this:

    game_tags = list(filter(
        lambda x: 'href' in x.attrs and x.attrs['href'].startswith('https://www.vgchartz.com/game/'),
        # discard the first 10 elements because those
        # links are in the navigation bar
        soup.find_all("a")
    ))

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

4 participants