Move web archives into dedicated directory
This commit is contained in:
@@ -4,10 +4,10 @@ require "uri"
|
||||
require "digest"
|
||||
require "time"
|
||||
|
||||
path, *urls = ARGV
|
||||
*urls = ARGV
|
||||
|
||||
unless path && urls.any?
|
||||
warn "Please supply a path and url"
|
||||
unless urls.any?
|
||||
warn "Please supply one or more URLs"
|
||||
exit 1
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ urls.each do |url|
|
||||
|
||||
filename = "#{URI.parse(url).host.gsub(".", "-")}-#{hash}.txt"
|
||||
|
||||
File.write("#{path}/#{filename}", text_content)
|
||||
File.write("static/archive/#{filename}", text_content)
|
||||
|
||||
puts <<~STR
|
||||
- title: "#{title}"
|
||||
@@ -27,7 +27,7 @@
|
||||
{{ range . }}
|
||||
<li>
|
||||
“<a href="{{ .url }}">{{ .title }}</a>”;
|
||||
<a href="{{ .file }}">
|
||||
<a href="/archive/{{ .file }}">
|
||||
backed up {{ .date | time.Format "2006-01-02 15:04:05 MST" }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user