Fix some stuff with getnhentai, add 2nd arg that allows creating dirs if present
This commit is contained in:
parent
7c1ff29270
commit
d071a9becc
@ -14,11 +14,13 @@ function ffmpeg-compress {
|
||||
ffmpeg -hwaccel vdpau -i $1 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $2
|
||||
}
|
||||
function getnhentai {
|
||||
local pageinfo="$(curl -sL $1 | grep -oP '(?<=var gallery = new N.gallery\().*(?=\);)' | jq '{"pages": .num_pages,"id": .media_id, "types": [.images.pages[].t]}')"
|
||||
local pageinfo="$(curl -sL $1 | grep -oP '(?<=var gallery = new N.gallery\().*(?=\);)' | jq '{"pages": .num_pages,"id": .media_id, "types": [.images.pages[].t], "title": .title.pretty}')"
|
||||
local media_id=$(print $pageinfo | jq -r '.id')
|
||||
local types=($(print $pageinfo | jq -r '.types[]'))
|
||||
local num_pages=$(print $pageinfo | jq '.pages')
|
||||
local dir=$(print $pageinfo | jq -r '.title')
|
||||
local urls=()
|
||||
[ ! -z $2 ] && mkdir "$dir" && cd "$dir"
|
||||
for i in {1..$num_pages}; do
|
||||
local ctoi=$(($i - 1))
|
||||
[[ ${types[$ctoi]} == p ]] && local type=png || local type=jpg
|
||||
@ -29,6 +31,7 @@ function getnhentai {
|
||||
local sortname="$(printf "%.3i" "${i%%.*}").${i##*.}"
|
||||
[ $sortname = $i ] || mv $i $sortname
|
||||
done
|
||||
[ ! -z $2 ] && cd ..
|
||||
}
|
||||
function gethanime {
|
||||
local IDS=($(curl -sSL "https://members.hanime.tv/api/v3/videos_manifests/$1" -H 'x-directive: api' | jq -e '.videos_manifest.servers[].streams | sort_by(.width) | .[].id'))
|
||||
|
Loading…
Reference in New Issue
Block a user