Requirements
Here’s what you’ll need to follow along with this guide:- URLs of the news outlets you want to aggregate
- Python 3
- The following Python modules
Setup
Install the required modules using pip:Get clean URLs
To get the clean URLs of the news outlets, you can use the following function:lang
parameter to get it. For example, if you want to
get the news articles for 'arabic.rt.com'
and 'francais.rt.com'
, you can’t
just use the clean URL because it will be the same for both of them, 'rt.com'
.
Get news articles
Once you have the clean URLs of the news sources you want to aggregate, you can simply pass them as a list to the sources parameter of thev2/search
endpoint
to get the articles. And that’s it!
Let’s say you wanted to aggregate all news articles from The New York Times and
The Guardian published in the last week.
All you would need to do is use the get_search()
method to fetch the articles:
