Last active
March 10, 2020 00:20
-
-
Save hyuki/50eaa7b1ce69ef3821ab12b6a03a56a5 to your computer and use it in GitHub Desktop.
url-markdown.rb - URL to Markdown
This file contains 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: url-markdown URL") | |
end | |
url = ARGV[0] | |
if !url.match(/^http/) | |
url = "https://" + url | |
end | |
agent = Mechanize.new | |
page = agent.get(url) | |
puts "- [#{page.title}](#{url})" | |
# vim: set filetype=ruby: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://twitter.com/hyuki/status/1237014780197519364