Skip to content

Instantly share code, notes, and snippets.

@nickserv
Last active August 29, 2015 13:57
Show Gist options
  • Save nickserv/9634511 to your computer and use it in GitHub Desktop.
Save nickserv/9634511 to your computer and use it in GitHub Desktop.
A simple script that shows the text contents of any web page
# usage: ruby web_cat.rb URL
require 'nokogiri'
require 'open-uri'
uri = ARGV[0]
doc = Nokogiri::HTML open uri
puts doc.text
@nickserv
Copy link
Author

This gets the text contents of the page as if you rendered it and removed all formatting, not the entire source code of the page. For example, <b>Hello, world!</b> would display as Hello, world!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment