summaryrefslogtreecommitdiff
path: root/bin/cdxget
blob: 1dbc8f03d1fdb5302b401b34a5c9886aa7ce60d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash
# Copyright (c) 2017, 2023  Luke Shumaker <lukeshu@lukeshu.com>
#
# This work is free.  You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License,
# Version 2, as published by Sam Hocevar.  See the COPYING file for
# more details.

url='http://web.archive.org/cdx/search/cdx'
s='?'
for arg in "$@"; do
	url+="$s${arg%%=*}=$(printf '%s' "${arg#*=}"|urlencode)"
	s='&'
done
curl -sfL "$url"