Module: Hashbang::Crawler
Instance Method Summary collapse
Instance Method Details
#gimme(url, timeout) ⇒ Object
5 6 7 |
# File 'lib/hashbang/crawler.rb', line 5 def gimme(url, timeout) Sunscraper.scrape_url url, timeout end |
#urlFromRack(environment) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hashbang/crawler.rb', line 9 def urlFromRack(environment) url = [] url << environment['rack.url_scheme'] + '://' url << environment['HTTP_HOST'] url << environment['REQUEST_PATH'] url << '?' unless environment['QUERY_STRING'].starts_with? '_escaped_fragment_' url << environment['QUERY_STRING'].gsub(/(\&)?_escaped_fragment_=/, '#!') url.join '' end |
#urlFromUrl(url) ⇒ Object
20 21 22 |
# File 'lib/hashbang/crawler.rb', line 20 def urlFromUrl(url) url.gsub(/[\?\&]_escaped_fragment_=/, '#!') end |