SSujitX / google-news-url-decoder

A Python script to decode Google News article URLs.
MIT License
57 stars 3 forks source link

Please update decode_google_news_url.py to reflect code in README.md #1

Closed mpetagara closed 3 months ago

mpetagara commented 3 months ago

line 10 in decode_google_news_url.py includes the following line: path[path.length - 2] == "articles"

line 12 decode_google_news_url.py includes the following line: base64_str = path[path.length - 1]

Your README.me does contains the proper code path[-2] == "articles" and path[-1], respectfully.

Thanks

SSujitX commented 3 months ago

Check updated. thanks.

mpetagara commented 3 months ago

The README.md was correct.

decode_google_news_url.py currently includes the lines:

line 10: path[path.length - 2] == "articles"

line 12: base64_str = path[path.length - 1]

As written it will cause an AttributeError "AttributeError: 'str' object has no attribute 'length' ". The code should read one of these options:

path[len(path) - 2] == "articles" base64_str = path[len(path) - 1]

or

path[-2] == "articles" base64_str = path[-1]

SSujitX commented 3 months ago

Yes, you are right; it should be len, length for js/ts. I didn't notice. Thank you.

mpetagara commented 3 months ago

No problem. Thanks for creating this repo, convenently I was also looking for a way to decode Google RSS Feed urls.