3 ms·
Since session cookies are required, here is a simple script for judyrecords searching from command line. It uses links browser and tmux. #!/bin/sh #
by 1vuio0pswjnm7 6y ago
Since session cookies are required, here is a simple script for judyrecords searching from command line. It uses links browser and tmux.
#!/bin/sh
# usage: 1.sh [query] -- perform search
# usage: 1.sh -- process results page 1 to 200
# usage: n=5 1.sh -- process results page 5 to 200
# usage: n=201 1.sh -- quit
# start tmux if not already running then detach
j=https://www.judyrecords.com;
case $# in
1)
tmux set set-remain-on-exit on;
tmux neww links;
tmux send g $j/addSearchJob?search="$@" c-m;
sleep 1.5;
tmux send d;
tmux capturep -p|sed -n /./p;
tmux send g $j/getSearchJobStatus c-m;
sleep 1.5;
tmux send d;
tmux capture -p|sed -n /./p;
;;0)
test $n||n=1;while true;do test $n -le 200||break;
tmux send g $j/getSearchResults?page=$n c-m;
sleep 2;
tmux send Down Down '\'
# small monitor where results page HTML takes 4 spacebar presses to get to bottom;
m=0;while true;do test $m -le 3||break;
# process results -- e.g., print record URLs;
tmux capturep -p|sed -n "/href=..record/{s|.*record.|$j/record/|;s/\"//;p;}";
tmux send Space;
m=$((m+1));done;n=$((n+1));done;
tmux killw;
esac
- 1vuio0pswjnm7 6y agoUpdated and improved #!/bin/sh j=https://www.judyrecords.com; case $# in 1) tmux new -P -d links; tmux set set-remain-on-exit on; tmux send g; tmux send $j/addSearchJob?search="$@"; tmux send c-m; sleep 1.7; tmux send d; tmux capturep -p|sed -n /./p; tmux send g; tmux send $j/getSearchJobStatus; tmux send c-m; sleep 1.7; tmux send d; tmux capture -p|sed -n /./p; ;;0) test $n||n=1;while true;do test $n -le 200||break; tmux send Down tmux send Down tmux send g tmux send $j/getSearchResults?page=$n tmux send c-m; sleep 2; tmux send Down tmux send Down tmux send Escape; tmux send F tmux send v tmux send c-u tmux send 1.htm tmux send c-m tmux send o sed -n "/href=\"\/record/{s,.*record\/,$j/record/,;s,\",,;p;}" 1.htm; __grepq=$(exec sed -n '/a class=\"goToNextPage/!d;=;q' 1.htm); test ${#__grepq} -gt 0||break; n=$((n+1)); done; tmux killw ; esac
- op03 6y agoInteresting. Haven't seen links being used in a while. Thanks for posting.