Skip to content

Instantly share code, notes, and snippets.

@verdi327
Created March 23, 2012 19:31
Show Gist options
  • Save verdi327/2174134 to your computer and use it in GitHub Desktop.
Save verdi327/2174134 to your computer and use it in GitHub Desktop.
require "nokogiri"
require 'rubygems'
require 'open-uri'
class Tagger
url = "http://coding.smashingmagazine.com/2012/03/22/device-agnostic-approach-to-responsive-web-design/"
doc = Nokogiri::HTML(open(url))
possible_tags = []
meta_keywords = doc.xpath('//meta[@name="keywords"]/@content').map(&:text)
title_text = doc.css("title").text
possible_tags << [meta_keywords, title_text]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment