Skip to content

feat: add flag to control whether to preserve additional links in the description #157

Open
Ayaa17 wants to merge 1 commit into
ranahaani:masterfrom
Ayaa17:des_detail
Open

feat: add flag to control whether to preserve additional links in the description #157
Ayaa17 wants to merge 1 commit into
ranahaani:masterfrom
Ayaa17:des_detail

Conversation

@Ayaa17
Copy link
Copy Markdown

@Ayaa17 Ayaa17 commented Dec 1, 2025

Each news item’s description may contain additional related news titles and links. A flag is introduced to control whether these extra links should be preserved, with the default behavior set to false.

sample code

google_news = GNews(des_keep_url=True) # or False
top_news = google_news.get_top_news()
print(top_news[0]['description'])

des_keep_url is True output:

[{'title': 'Trump allies dismiss Washington Post report on killing Venezuela boat strike survivors', 'url': 'https://news.google.com/rss/articles/CBMiiAFBVV95cUxNSnRlaS00UWFiR3BLUlgtMlpDUWZmbThGNERPYlh3TzZkeHdLY1dpcTl0NENtcEV5TG5CclJNZHRzZXhEMEpHUGR2bm1kLUtfNHJLMWN6N3hFV3pmMDdPRWp6NTF1d3hEbmV6ZklkUjFWaW5XYkIwUmFpMjZwUkdYbmR2ZEZaM0JO?oc=5'},
 {'title': 'Lawmakers Suggest Follow-Up Boat Strike Could Be a War Crime', 'url': 'https://news.google.com/rss/articles/CBMihwFBVV95cUxPemFLdWJNaS1GNTRIUVVoeV9uOTZyMlMwWHNhTEVLZTZXVjJFTjRHa1R4UXExMXpEZUlaZ2xkRnphY0tVZWd6MzJOTV80akw4Qy16WlJqNFB2eGd0UWdscXRSNHJQNXBFNXphMjhfTm5KdFFYOVltLTV3bjAtMlA0SVdQc2EyY2c?oc=5'},
 {'title': 'Trump says Hegseth told him he didn’t order killing of boat crew', 'url': 'https://news.google.com/rss/articles/CBMipgFBVV95cUxPVGkxNnNqQ2REbnk2eDEtUUJGUjI5LWFiZFNTUFNWSUhORHFqU3ktbzFXSDVWX3RHR1JoTmRiSUFwUjlKUmxFWERDb2JRNVVlM0lhdVctNmMzaXFmRjhFLS01RU5Ga21nelNfQ2dEQUgyYkJKbTRleVpMdUdoa1RPWUNMVHJ2cHVXMHdtcW94ZVlLQUJHRjBWeUF0amN3eExONUNXY3pn?oc=5'},
 {'title': 'Lawmakers voice support for congressional reviews of Trump’s military strikes on boats', 'url': 'https://news.google.com/rss/articles/CBMitgFBVV95cUxNYy13cTFlQ0U0d2pGTW5PYjc3TFVQazc2RS1wLThhbl9lTGh6anpMLW5TQndaOEZRN0tyajFDRVlVdVNiaHJIbXR3SjZjYnBxTGpyUy1VUThJUVpDSTRMREtLampLeUR0U0xqc2RIWlZfdjJxS01EWFJocmlucGh5MTRkZk1nYW1rTDVmbk5KZUUyRllSTXdJOGItV2VTQnhONmhINWU1Xzh2YU9XN2JOVXJHY3RQZw?oc=5'},
 {'title': 'Lawmakers warn Hegseth may have committed war crimes following second-strike report', 'url': 'https://news.google.com/rss/articles/CBMijwFBVV95cUxOTGVmN0pIOFlfS0lPSThMX0xteDZ0RUpvRHpHbVU3MG5OaWw1ZGt1OWJGNzJ6bUtoc0JFU0xOUERJQzdadXZXdzZFaXA3WDBMZmp3XzlKNzg0bGplZXJ1VkdJQTEzNzRpcUtXZVBqU2F0R3VyVjAxVy12YUVMVzdRR3dZMGwwVjBIdEM2VkpwMA?oc=5'}]

des_keep_url is False output:

Trump allies dismiss Washington Post report on killing Venezuela boat strike survivors  AxiosLawmakers Suggest Follow-Up Boat Strike Could Be a War Crime  The New York TimesTrump says Hegseth told him he didn’t order killing of boat crew  The Washington PostLawmakers voice support for congressional reviews of Trump’s military strikes on boats  AP NewsLawmakers warn Hegseth may have committed war crimes following second-strike report  Politico

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.

1 participant