class UrlExpander::Expanders::Simurl

Expand simurl.com/ URLS Usage: UrlExpander::Client.expand(“simurl.com/fendaz”)

Constants

PATTERN

Attributes

parent_klass[R]

Public Class Methods

new(short_url="", options={}) click to toggle source
Calls superclass method UrlExpander::Expanders::Scrape::new
# File lib/url_expander/expanders/scrape/simurl.rb, line 12
def initialize(short_url="", options={})
  @parent_klass = self.class
  super(short_url, options)
end
scrape_url(html) click to toggle source

How to scarpe the url from a Qsr.li html document

# File lib/url_expander/expanders/scrape/simurl.rb, line 18
def self.scrape_url(html)
  doc = Hpricot(html)
  str = doc.at("meta").attributes['content']
  start_slice = str.index("=") +1
  end_slice   = str.size - start_slice 
  url = str.slice(start_slice, end_slice)
  raise UrlExpander::Error.new('page not found',404) if url == "/index.php"
  url
end