Created
May 13, 2017 08:54
get-title - URLを与えると、そのページのURLとタイトルをいろんな形式で出力する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'mechanize' | |
if ARGV.length != 1 | |
abort("Usage: get-title URL") | |
end | |
url = ARGV[0] | |
agent = Mechanize.new | |
page = agent.get(url) | |
puts "[#{page.title}](#{url})" | |
puts %Q(<a href="#{url}">#{page.title}</a>) | |
puts " ◆#{page.title}" | |
puts " #{url}" | |
# vim: set filetype=ruby: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HTMLだけのバージョン