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

fix(gnews): fixed prepare_gnews_url function #653

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fasihhussain00
Copy link

Related Issues

Proposed Changes:

Reason:

The prepare_gnews_url function in the google_news.py file was causing a crash due to an AttributeError. Specifically, the error message observed was: AttributeError: 'NoneType' object has no attribute 'groupdict'
This occurred while attempting to access primary_url = match.groupdict()["primary_url"] which failed because match was None at the time of execution.

Found out google has changed something and code wasn't able to decode the url.

Proposed Solution

Found a package google-news-url-decoder used it, it basically does an HTTP get request to get the url.

How did you test it?

I ran the specific tests related to this change. The tests were previously failing due to the error, but after the fix, they passed without any modification to the test cases.

Notes for the reviewer

I ran into a problem with the Python version compatibility. I was able to resolve the issue by setting the minimum Python version to 3.9.

Checklist

  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@fasihhussain00
Copy link
Author

Hi @AndyTheFactory, I hope you're doing well! Could you kindly take a look at this? It’s quite important for my work. I’d really appreciate your help!

@fasihhussain00 fasihhussain00 changed the title fix: gnews prepare_gnews_url function fix(gnews): fixed prepare_gnews_url function Jan 4, 2025
@ThomasAlbrt
Copy link

Unfortunately looks like the repo isn't maintained anymore.

Can't wait for newspaper5k 😬

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

Successfully merging this pull request may close these issues.

[BUG] Google News link schema changed?
2 participants