News API is a simple HTTP REST API for searching and retrieving live news articles from all over the web. Using this, one can fetch the top stories running on any news website or can search top news on a specific topic (or keyword).
News can be retrieved based on some criteria. Say the topic (keyword) to be searched is ‘Geeksforgeeks’ or might be concerned to a specific channel. All can be done, but the API key is needed to get started.
Steps : 1. Visit https://newsapi.org/ to get your own API key. 2. Install requests package.
Below is the implementation of above idea :
1 Italy to lift coronavirus travel restrictions 2 White House 'Operation Warp Speed' to look for Covid jab 3 Two Americas in the nation's capital 4 Kobe Bryant helicopter crash post-mortem released 5 Little things people are doing while socially distanced 6 The last 'normal' photo on your phone 7 'They came to kill the mothers' 8 EU-UK Brexit trade talks in trouble 9 Trial starts to see if dogs can 'sniff out' virus 10 Beatles photographer Astrid Kirchherr dies aged 81
Note : Output may change based on the top articles at time.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.