A personalized news aggregator.
Leafthru brings together your favorite news through your Twitter feed, using Watson API to analyze text on webpages.
-
Upon signing up, users can input their Twitter handle.
-
When they access the feed page, a GET request is made to
/feeds/twitter
. -
Twitter feed: Getting articles from an user's Twitter timeline is a two-step process.
- First, the Twitter client gets posts from user's timeline. Loop through the posts and retain the URLs, excluding those containing media (e.g. Pinterest, YouTube).
# lib/twitter.rb
def get_timeline(username, num_results)
end
- The article links are fed through the Watson API (credentials) analyze endpoint to parse out the article's title and summary. These requests are made in parallel using threads.
- Articles are cached for 2 hours
- If the user authenticates with Pocket, bookmarking an article also saves the item to their Pocket account. (Developer docs).
- Use a rake task to collect articles from Twitter at intervals.