Learn R Programming

tm.plugin.webmining (version 1.3)

NYTimesSource: Get feed data from NYTimes Article Search (http://developer.nytimes.com/docs/read/article_search_api_v2).

Description

Excerpt from the website: "With the NYTimes Article Search API, you can search New York Times articles from 1981 to today, retrieving headlines, abstracts, lead paragraphs, links to associated multimedia and other article metadata. Along with standard keyword searching, the API also offers faceted searching. The available facets include Times-specific fields such as sections, taxonomic classifiers and controlled vocabulary terms (names of people, organizations and geographic locations)." Feed retrieval is limited to 1000 items (or 100 pages).

Usage

NYTimesSource(query, n = 100, appid, count = 10, sleep = 1, params = list(format = "json", q = query, page = 1:ceiling(n/count), `api-key` = appid), curlOpts = curlOptions(followlocation = TRUE, maxconnects = 10, maxredirs = 10, timeout = 30, connecttimeout = 30), ...)

Arguments

query
character specifying query to be used to search NYTimes articles
n
number of items, defaults to 100
appid
Developer App id to be used, obtained from http://developer.nytimes.com/
count
number of results per page, defaults to 10
sleep
integer; Seconds to sleep between feed retrieval.
params
additional query parameters, specified as list, see http://developer.nytimes.com/docs/read/article_search_api
curlOpts
CURLOptions; RCurl options used for feed retrieval.
...
additional parameters to WebSource

See Also

WebSource, readNYTimes

Examples

Run this code
## Not run: 
# #nytimes_appid needs to be specified
# corpus <- WebCorpus(NYTimesSource("Microsoft", appid = nytimes_appid))
# ## End(Not run)

Run the code above in your browser using DataLab