lib/gscraper/sponsored_ad.rb in gscraper-0.2.3 vs lib/gscraper/sponsored_ad.rb in gscraper-0.2.4
- old
+ new
@@ -1,10 +1,10 @@
#
#--
# GScraper - A web-scraping interface to various Google Services.
#
-# Copyright (c) 2007-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
+# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@@ -38,13 +38,20 @@
@title = title
@url = url
end
#
+ # Returns the direct link of the ad.
+ #
+ def direct_link
+ @url.query_params['adurl'] || @url.query_params['q']
+ end
+
+ #
# Returns the direct URL of the ad.
#
def direct_url
- URI(@url.query_params['adurl'] || @url.query_params['q'])
+ URI(URI.escape(direct_link))
end
#
# Returns the title of the ad.
#