Module: YahooSports
- Defined in:
- lib/yahoo_sports.rb,
lib/yahoo_sports/mlb.rb,
lib/yahoo_sports/nba.rb,
lib/yahoo_sports/nfl.rb,
lib/yahoo_sports/nhl.rb,
lib/yahoo_sports/base.rb
Defined Under Namespace
Classes: Base, MLB, NBA, NFL, NHL
Class Method Summary collapse
-
.fetchurl(url) ⇒ Object
little helper method i wrote to retry the fetch a few times.
- .strip_tags(html) ⇒ Object
Class Method Details
.fetchurl(url) ⇒ Object
little helper method i wrote to retry the fetch a few times
19 20 21 22 |
# File 'lib/yahoo_sports/base.rb', line 19 def self.fetchurl(url) #puts "FETCHING #{url}" return Net::HTTP.get_response(URI.parse(URI.escape(url))).body end |
.strip_tags(html) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/yahoo_sports/base.rb', line 24 def self.(html) HTMLEntities.new.decode( html.gsub(/<.+?>/,''). gsub(/ /,' '). gsub(/&/,'&'). gsub(/"/,'"'). gsub(/</,'<'). gsub(/>/,'>'). gsub(/&ellip;/,'...'). gsub(/'/, "'"). gsub(/<br *\/>/m, '') ).strip end |