NYTimes NewsWire API Assignment

source code

Posted in Homework | Leave a comment

NYT RealEstate

I just wanted to see what section gets the most real estate in The New York Times during a given time period (within one week).

Posted in Homework | Leave a comment

Homework: NYT Newswire, Sections by Article Volume

Source Code: http://a.parsons.edu/~kopla138/data-viz/hw/wk6/NYTNS_HW6_v1/NYTNS_HW6_v1.pde

Posted in Homework | Leave a comment

NY Times API – Ryan


NY times API 1

NY times API 2

Posted in Uncategorized | Leave a comment

Times Newswire Pattern

I designed simple patterns and colors for each section (Arts, Movies, U.S., Style, Opinion, World, Sports etc.) of the Newswire. Each line of pattern corresponds to one article. When a new article comes up, a new line is added on the top. I had linked to the applet but I removed it during class after we discussed problems with applets.

Screenshots of the sketch at various times:


Posted in Uncategorized | Leave a comment

Opinions from the NYTimes

Posted in Homework | Leave a comment

New York Times Congress API

Some stills from my data visualization from the Congress API. It was sooooo much data, and hard to organize… I played with the data a bunch, but wasn’t able to find interesting patterns in the timeframe of the assignment…. Still, it was highly instructive, and I learned a lot about juggling API data, and about dealing with large amounts of data!

Photo outputs from the processing sketch as it progressively loads data from the NYT Congress API:

Posted in Homework | Leave a comment

Newswire API

Here is the code 🙂

import org.json.*;

String typeOfData = “json”;
String baseURL = “http://api.nytimes.com/svc/news/v3/content/NYT/Arts/.” + typeOfData + “?&limit=20”;
String apiKey = “#######”;
String headline;
String publishedDate;

void setup() {

//Getting the Data
//Create the URL to request
//String request = baseURL + “&title=” + headline + “&published_date=” + publishedDate + “&api-key=” + apiKey;
String request = baseURL + “&api-key=” + apiKey;

if(typeOfData.equals(“xml”)) {
XMLElement xml = new XMLElement(this, request);

XMLElement results = xml.getChild(“results”);
int nResults = results.getChildCount();

for(int i=0; i<nResults; i++) {
XMLElement thisArticle = results.getChild(i);
String title = thisArticle.getChild(“abstract”).getContent();

XMLElement des_facet = thisArticle.getChild(“des_facet”);
int nFacets = des_facet.getChildCount();

for(int j=0; j<nFacets; j++) {
String thisFacet = des_facet.getChild(j).getContent();

} else {

//JSON Stuff
//We try to get the data, if not we do the catch statement

//Get JSON from Server,”loadStrings() gets data, join adds “” to make sure it is a string
String result = join( loadStrings( request ), “”);

try {
//Convert Result string into JSON Object
JSONObject nytData = new JSONObject(result);

//Print the total results available

//Get results as an array
JSONArray results = nytData.getJSONArray(“results”);

//Results array has each article as a JSON Object, loop through and get each article
for(int i=0; i<results.length(); i++) {
//Create variable to reference this JSON object in array, setting type to JSON Object so compiler doesn’t freak out
JSONObject thisArticle = (JSONObject)results.get(i);

//Print Title
String title = thisArticle.getString(“title”);

//thisArticle is JSON Object, to loop through des_facet we get it as an array of JSON Objects from thisArticle
//Use Try…Catch because not every article has des_facet
try {
//Get array
JSONArray desFacet = thisArticle.getJSONArray(“des_facet”);

//Loop through
for(int j=0; j<desFacet.length(); j++) {
//Print each item
} catch (JSONException e) {
println(“No Des Facet for this article!”);

//Separate articles with blank line
catch (JSONException e) {
println (“There was an error parsing the JSONObject.”);

//Format Examples

//XML Format













//JSON Format
articles: {
article: {


Posted in Homework | Leave a comment

NY Times Newswire API code

Here’s the code that Steve demo’ed to us today. It pulls XML and JSON data from the NYTimes Newswire API in Processing and displays it on the console.

NYTimes Newswire API

Posted in Uncategorized | Leave a comment

Data Viz Challenge: Skillshare @ Eyebeam this Weekend!

If anyone is interested!? Google Creative Lab will be there!


Posted in Uncategorized | Leave a comment