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 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 specific channel. All can be done, but 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 China hits back with tariffs on US imports 2 Trump rails at immigrant programme 3 'I have 29 textbooks for 87 pupils' 4 French rail strike set to test Macron 5 London murder rate overtakes New York's 6 Hill Street Blues creator dies aged 74 7 Villagers killed in Boko Haram clash 8 Kim 'moved' by K-pop peace concert 9 Former president's poisoning ordeal 10 Costa Rican president-elect wants 'unity'
Note : Output may change based on the top articles at time.