0.0
No commit activity in last 3 years
No release in over 3 years
A simple news fetch gem that returns data and prints it in a fancy color. Basic web scrapping.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 3.5

Runtime

>= 1.6.8, ~> 1.6.7
>= 11.1.2, ~> 11.1.2
 Project Readme

Badge

News Fetcher

News Fetcher is a simple gem that uses Nokogiri for parsing HTML documents fetched from the Internet and returns selected data that can be printed out to Unix STDOUT in a variety of colors like so:

Image

or

Image

Installation

$ gem install news_fetcher

or directly in your Gemfile

gem 'news_fetcher'

Usage

News Fetcher uses the OpenURI Ruby module to get the HTML content of a webpage and Nokogiri to parse the response given a structure (e.g. XPath). Use the fetch method to get the information you want from a certain url, also specifying the xPath you are looking for and the color you want to see your results (terminal only):

document, nodes = NewsFetcher.fetch('https://techcrunch.com', 'h2/a', 'orange')

document ### The Nokogiri HTML Document object
nodes ### The matching nodes found in the document

Available colors are:

  • Black
  • Red
  • Green
  • Orange
  • Blue
  • Purple
  • Cyan
  • Gray

If you don't specify the color it will take black by default

News Fetcher also provides a CLI so you can call it from your favorite terminal and see the results:

nf fetch http://www.bbc.com/ div/h3/a blue

or

news_fetcher fetch http://edition.cnn.com/tech div/h3/a/span red

MIT License

  • Copyright (c) 2016 Kevin Martin. See LICENSE.txt for details.