WSH はわからないけど、Ruby では、

require 'nokogiri'

html = `curl http://www.example.com/`
# curl は書き込めないので、全角に変換した

doc = Nokogiri::HTML( html )

elements = doc.css( "h1" )
puts elements.first.content #=> Example Domain