feat(fish): add some functions

This commit is contained in:
Bruno Carlin 2023-03-09 22:26:58 +01:00
parent b97881a4cf
commit 37ddabaef2
Signed by: bcarlin
GPG key ID: 8E254EA0FFEB9B6D
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,17 @@
function p-gspw-list-cat
set -l catid $argv[1]
set -l pages (http https://gaystream.pw/video/channel/$catid \
| htmlq --attribute href ".nav-links a.page-numbers:nth-last-child(2)" \
| sed -e "s:.*/\([0-9]*\)\(?.*\)\?:\1:")
if test -z $pages
set pages 1
end
for i in (seq $pages -1 1)
sleep 0,2
curl --location --silent https://gaystream.pw/video/channel/$catid/page/$i \
| htmlq --attribute href "main a[rel=bookmark]" \
| tac
end
end

View file

@ -0,0 +1,16 @@
function p-gvtu-list-cat
set -l catid (echo (curl https://gayvids.tube/studio/$argv[1]/ 2>/dev/null \
| grep 'rel="alternate" type="application/json"'\
| sed 's:.*href="\([^"]\+\).*:\1:' \
| string split "/")[-1])
set -l pages (curl -v -X HEAD https://gayvids.tube/wp-json/wp/v2/posts?categories=$catid 2>&1 \
| grep x-wp-totalpages \
| string trim \
| string split " " -f 3)
for i in (seq $pages -1 1)
sleep 0,2
curl https://gayvids.tube/wp-json/wp/v2/posts?categories=$catid&page=$i 2>/dev/null \
| jq -r ".[].link" | tac
end
end