Improved sav-quotes to avoid empty quotes and messy embedded HTML
This commit is contained in:
parent
0dea194992
commit
b55250f583
2 changed files with 12 additions and 5 deletions
|
@ -10,12 +10,13 @@ list_srcs() {
|
||||||
}
|
}
|
||||||
save_from_src() {
|
save_from_src() {
|
||||||
mkdir -p ${dest:h}
|
mkdir -p ${dest:h}
|
||||||
rm $dest
|
rm -f $dest
|
||||||
|
|
||||||
for i in {1..5}
|
for i in {1..5}
|
||||||
do
|
do
|
||||||
$src >> $dest
|
$src >> $dest
|
||||||
wc -l $dest
|
(( i < 5 )) && echo % >> $dest
|
||||||
|
wc -l $dest
|
||||||
done
|
done
|
||||||
strfile $dest
|
strfile $dest
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
sum() {
|
||||||
|
declare -i acc
|
||||||
|
for i; do acc+=i; done
|
||||||
|
echo $acc
|
||||||
|
}
|
||||||
|
|
||||||
curl http://www.xkcdb.com/\?random1 | hxnormalize -i 0 -l 99999999999 -x | hxremove br | hxselect -cs '\n%\n' 'span.quote' | hxunent
|
curl -s 'http://www.xkcdb.com/?random1' |
|
||||||
exit ${PIPESTATUS[0]}
|
hxnormalize -i 0 -l 99999999999 -x | hxselect -cs '<br>\n%<br>\n' 'span.quote' |
|
||||||
|
html2text -b 0 | hxunent | sed '$d; s/ *$//' | sed '$d'
|
||||||
|
exit $(sum ${PIPESTATUS[*]})
|
||||||
|
|
Loading…
Reference in a new issue