Project

raev

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Fetch, parse and normalize meta data from websites.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14.6
= 2.3.7
= 3.2.4

Runtime

>= 0.10.2
>= 2.1.0
>= 1.8.0
>= 2.1.0
 Project Readme

Raev

Raev is a Ruby gem for fetching, parsing and normalizing meta data from websites. It was extracted from http://promoterapp.com.

Install

gem install raev

or add the following line to Gemfile:

gem 'raev'

and run bundle install from your shell.

Usage

Get the domain name from an url without the www. subdomain.

Raev::Url.base("http://indiegames.com/2011/05/c418_minecraft_volume_alpha.html")
# => "indiegames.com"

Remove UTM analytics parameters from an url.

Raev::Url.remove_utm("http://www.ign.com/articles/2011/06/24/new-controllers-for-the-disabled-debuts-and-promises-change&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ignfeeds%2Fgames+%28IGN+Videogames%29")
# =>  "http://www.ign.com/articles/2011/06/24/new-controllers-for-the-disabled-debuts-and-promises-change"

Resolve a shortened or proxied url.

Raev.url("http://sbn.to/WRgXfl").url
# => "http://www.polygon.com/features/2013/3/25/4128022/gdc-gathering-of-game-makers"

Fetch Twitter handle from url.

Raev.url("http://www.polygon.com").twitter
# => "polygon"

Fetch RSS feed from url.

Raev.url("http://www.polygon.com").feed
# => "http://www.polygon.com/rss/index.xml"

Fetch headline from url. Removes double spaces.

Raev.url("http://www.polygon.com/e3-2013/2013/6/14/4429126/the-indie-eight-ps4").headline
# => "The Indie Eight: Polygon talks with the showcase indies launching on PS4"

Parse review scores.

review = Raev.url("http://www.gamesradar.com/superhot-review/")
review.ratingValue
# => 4.5
review.bestRating
# => 5.0

Normalize author name. Capitalizes name, strips whitespace, ignores email addresses and removes silly nicknames in quotes. Returns nil for empty strings or non-names like Editor or Staff.

Raev.normalize_author("andreas@somedomain.com (Andreas)")
# => "Andreas"

Raev.normalize_author("andreas")
# => "Andreas"

Raev.normalize_author("Andreas 'Pixelate' Zecher")
# => "Andreas Zecher"

Raev.normalize_author("Editor")
# => nil

Raev.normalize_author(" ")
# => nil

Code Climate