feat(fish): add some functions
This commit is contained in:
parent
b97881a4cf
commit
37ddabaef2
2 changed files with 33 additions and 0 deletions
17
fish/.config/fish/functions/p-gspw-list-cat.fish
Normal file
17
fish/.config/fish/functions/p-gspw-list-cat.fish
Normal 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
|
16
fish/.config/fish/functions/p-gvtu-list-cat.fish
Normal file
16
fish/.config/fish/functions/p-gvtu-list-cat.fish
Normal 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
|
Loading…
Add table
Reference in a new issue