Sha256: 18d9ae47e1b4e5b213887d287c3a98f9cee80de7cc365412110fc0fda8064801

Contents?: true

Size: 901 Bytes

Versions: 34

Compression:

Stored size: 901 Bytes

Contents

# A basic MetaInspector example for scraping a page
#
# Usage example:
#
#   ruby basic_scraping.rb jaimeiniesta.com

require '../lib/metainspector'
puts "Using MetaInspector #{MetaInspector::VERSION}"

# Get the starting URL
url = ARGV[0] || (puts "Enter an url"; gets.strip)

page = MetaInspector.new(url)

puts "\nScraping #{page.url} returned these results:"
puts "\nTITLE: #{page.title}"
puts "META DESCRIPTION: #{page.meta['description']}"
puts "META KEYWORDS: #{page.meta['keywords']}"

puts "\n#{page.links.internal.size} internal links found..."
page.links.internal.each do |link|
  puts " ==> #{link}"
end

puts "\n#{page.links.external.size} external links found..."
page.links.external.each do |link|
  puts " ==> #{link}"
end

puts "\n#{page.links.non_http.size} non-http links found..."
page.links.non_http.each do |link|
  puts " ==> #{link}"
end

puts "\nto_hash..."
puts page.to_hash

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
metainspector-5.15.0 examples/basic_scraping.rb
metainspector-5.14.0 examples/basic_scraping.rb
metainspector-5.13.1 examples/basic_scraping.rb
metainspector-5.13.0 examples/basic_scraping.rb
metainspector-5.12.1 examples/basic_scraping.rb
metainspector-5.12.0 examples/basic_scraping.rb
metainspector-5.11.2 examples/basic_scraping.rb
metainspector-5.11.1 examples/basic_scraping.rb
metainspector-5.11.0 examples/basic_scraping.rb
metainspector-5.10.1 examples/basic_scraping.rb
metainspector-5.10.0 examples/basic_scraping.rb
metainspector-5.9.0 examples/basic_scraping.rb
metainspector-5.8.0 examples/basic_scraping.rb
metainspector-5.7.0 examples/basic_scraping.rb
metainspector-5.6.0 examples/basic_scraping.rb
metainspector-5.5.0 examples/basic_scraping.rb
metainspector-5.4.3 examples/basic_scraping.rb
metainspector-5.4.2 examples/basic_scraping.rb
metainspector-5.4.1 examples/basic_scraping.rb
metainspector-5.4.0 examples/basic_scraping.rb