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