You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yacy_search_server/bin/search1.sh

34 lines
962 B

#!/usr/bin/env sh
cd "`dirname $0`"
if which curl > /dev/null; then
while getopts "ys" opt; do
case $opt in
y)
shift;
curl -sSf "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
s)
shift;
curl -sSf "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
esac
done
elif which wget > /dev/null; then
while getopts "ys" opt; do
case $opt in
y)
shift;
wget -q -O - "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
s)
shift;
wget -q -O - "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
;;
esac
done
else
echo "Neither curl nor wget installed!"
exit 1
fi