init :3
This commit is contained in:
commit
bb445aa85c
|
@ -0,0 +1,24 @@
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org>
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
booruMicro
|
||||||
|
-- replacement lib for booru34sh in only pure sh & curl
|
||||||
|
---- some features may be missing
|
||||||
|
---
|
||||||
|
Usage
|
||||||
|
-- ./booru34sh <service> "<tags>"
|
||||||
|
---- ./booru34sh r34 "femboy+anal"
|
||||||
|
---- +'s must be used
|
||||||
|
---
|
||||||
|
Current sites/services
|
||||||
|
-- e621
|
||||||
|
---- searchs e621 using given tags
|
||||||
|
---- uses e621's RAW html api
|
||||||
|
---- may be throttled
|
||||||
|
-- r34
|
||||||
|
---- searches r34/rule34.xxx
|
||||||
|
---- uses classic XML api
|
||||||
|
---
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/sh
|
||||||
|
has() {
|
||||||
|
case "$(command -v $1 2>/dev/null)" in
|
||||||
|
alias*|"") return 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
deps() {
|
||||||
|
deps="curl"
|
||||||
|
missing=0
|
||||||
|
for i in $deps; do
|
||||||
|
has $i || { echo "$i IS MISSING!"; exit 1; }
|
||||||
|
done
|
||||||
|
# Check for ssl
|
||||||
|
curl -V | grep tls -i -q || {
|
||||||
|
curl -V | grep ssl -i -q || {
|
||||||
|
echo "!!SSL/TLS SUPPORT IS MISSING FROM CURL!!"
|
||||||
|
echo "!!SOME SERVICES MAY NOT CONNECT!!"
|
||||||
|
http="http"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ ! "$http" ] && http="https" # default to https
|
||||||
|
}
|
||||||
|
count() {
|
||||||
|
c=0; IFS=' +'; for i in $1; do
|
||||||
|
: $((c+=1))
|
||||||
|
done
|
||||||
|
echo "$c"
|
||||||
|
# pure shell counter function
|
||||||
|
|
||||||
|
# heredocs are used as piping to the while loop puts the while loop in a subshell
|
||||||
|
# due to this subshell the value of $c is forgotten once the loop ends
|
||||||
|
# heredocs don't create a subshell, but are able to redirect the contents of a subshell
|
||||||
|
unset IFS
|
||||||
|
}
|
||||||
|
rule34(){
|
||||||
|
while read -r p || [ "$p" ]; do
|
||||||
|
F="${p##*file_url=?}"; F="${F%%? parent_id*}"
|
||||||
|
[ "$F" = "$p" ] && continue # skip line if above has chaned nothing
|
||||||
|
printf '%s:' "$F"
|
||||||
|
I="${p##* id=?}"; I="${I%%? width*}"; printf '%s\n' "$I"
|
||||||
|
done << EOF
|
||||||
|
$(curl -sL "$http://rule34.xxx//index.php?page=dapi&s=post&q=index&tags=$2&limit=1000&pid=${pid:-0}&json=0")
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
e621(){
|
||||||
|
while read -r p || [ "$p" ]; do
|
||||||
|
F="${p##* data-file-url=?}"; F="${F%%? data-large-file-url*}"
|
||||||
|
[ "$F" = "$p" ] && continue # skip line if above has chaned nothing
|
||||||
|
printf '%s:' "$F"
|
||||||
|
I="${p##* data-id=?}"; I="${I%%? data-has-sound*}"; printf '%s\n' "$I"
|
||||||
|
done << EOF
|
||||||
|
$(curl -sL "$http://e621.net/posts?tags=$2&limit=120" --user-agent "booruMicro (https://dicksdeathabove.xyz/~mia/booruMicro)")
|
||||||
|
EOF
|
||||||
|
# e621 requires a UA
|
||||||
|
}
|
||||||
|
deps
|
||||||
|
case "$1" in
|
||||||
|
r34|rule34|e621)
|
||||||
|
[ "$1" = "r34" ] && { rule34 "$@"; exit 0; } || { ${1} "$@"; };;
|
||||||
|
*) echo "Please select a service.."; exit 1
|
||||||
|
esac
|
Loading…
Reference in New Issue