class ESpider::Front::Qunar::Base
Constants
- BASEURI
Public Class Methods
new(hotelId)
click to toggle source
# File lib/espider/front/qunar/base.rb, line 8 def initialize(hotelId) raise "id should be string" if !hotelId.instance_of?(String) @HotelSEQ = hotelId @cityurl = hotelId[0..hotelId.rindex("_",-1)-1] @hotelcode = hotelId[hotelId.rindex("_",-1)+1..hotelId.length] end
Public Instance Methods
parse_mixkey()
click to toggle source
# File lib/espider/front/qunar/base.rb, line 14 def parse_mixkey uri = URI(File.join(BASEURI, 'city', @cityurl, "dt-#{@hotelcode}")) http_res = HTTParty.get uri.to_s res = Nokogiri::HTML http_res node = res.search('//span[@id="eyKxim"]').first return nil if node.nil? return node.text end