class ESpider::Front::TA::TripAdvisor

Attributes

base_url[RW]

Public Class Methods

new(ta_id) click to toggle source
# File lib/espider/front/ta.rb, line 6
def initialize(ta_id)
        url = base_url+ta_id
        res = HTTParty.get(url)
        @code = res.code
        @page = res.force_encoding("UTF-8")
end

Public Instance Methods

code() click to toggle source
# File lib/espider/front/ta.rb, line 12
def code
        @code
end
rank() click to toggle source
# File lib/espider/front/ta.rb, line 15
def rank
        ranks = []
        @page.scan(/(Vendor\(.*\);)$/) do |ota|
                ranks << ota[0].match(/\}\),\s*\".*\",/)[0].sub("}), \"","").sub("\",","")
        end
        ranks
end