Description Usage Arguments Details Examples
get_news
returns news articles from the Newsriver API matching a user
provided search query.
1 2 |
query |
Character string, specifying the query to be searched when
calling the Newsriver API. Many fields of retrieved articles can be
searched, but To build valid search queries, search terms can be passed into the
title and text fields using a colon. For example, to search
for any articles containing the word "Google" in the text, use
To search exact phrases, use double quotes. To do this, either wrap single
quotes around a search query using double quotes, e.g.,
|
from, to |
Character string, specifying the date range of your search.
Must be in the "%Y-%m-%d" format. |
language |
Character string, specifying the language of the articles to return. Must be in the ISO 639-1 two-letter code format (e.g., "en", "it", "es", etc.). |
limit |
Integer, specifying the maximum number of results to return
per day between the supplied |
api_token, ua |
Character string, specifying a Newsriver API token and
user agent. Defaults to the values set using |
Search queries
get_news
calls the Newsriver API by generating custom HTTP GET
requests. These requests are composed of multiple query parameters (see the
Newsriver API
reference manual). While
many search fields of the Newsriver query parameter can be searched,
the query
parameter of get_news
should only be used to search
the title and text fields of new articles. This is because
other fields are handled by default or passed as alternate arguments to
get_news
(e.g., language).
Date sequences
Results from the Newsriver API are limited to a maximum of 100 articles per
GET request. In order to return the maximum number of results,
get_news
creates a sequence of search dates, by day, specified between
the from
and to
parameters. Each search date from the sequence
is then combined with the other query parameters to create a unique GET
request for that date. The results from each GET request are then combined
and returned.
Rate limiting
Rate limiting is handled automatically by get_news
.
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.