Skip to content

Retrieves news articles from specified sources

Notifications You must be signed in to change notification settings

marissadarnell/news-aggregator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

news-aggregator

This news aggregator extracts articles

  • from multiple sources (live url: newsapi.org, a calpoly news api, or a file)
  • in multiple formats (newsapi.org format, calpoly news api format)

with user-specified filtering (see example below, or input/config for more examples).
The user makes these specifications via passing a file as an argument when running the program.

url
name: NewsAPI Headlines (Live)
format: newsapi
source: http://newsapi.org/v2/top-headlines?country=us&apiKey={NEWS_API_KEY}
filter: Harris & ( washingtonpost | usatoday )
delay:300

For "live" sources, a delay can be specified and the source will be queried once per the given interval. This will add any new articles each time while discarding repeats.

This program supports concurrently (and repeatedly) retreiving articles by giving each specified news source a Runnable.
A BlockingQueue is used to print the retreived articles without interleaving each article's output.
The org.json library is used to parse the json response from each news source.
The ANTLR library is used to parse the filtering expressions into abstract syntax trees and the Visitor pattern is implemented to evaluate these filtering expressions.