mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
added user-agent in scripts
This commit is contained in:
36
ani-cli
36
ani-cli
@@ -5,6 +5,7 @@
|
|||||||
player_fn="mpv"
|
player_fn="mpv"
|
||||||
prog="ani-cli"
|
prog="ani-cli"
|
||||||
site="gogoanime.film"
|
site="gogoanime.film"
|
||||||
|
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
|
||||||
|
|
||||||
c_red="\033[1;31m"
|
c_red="\033[1;31m"
|
||||||
c_green="\033[1;32m"
|
c_green="\033[1;32m"
|
||||||
@@ -21,7 +22,6 @@ help_text () {
|
|||||||
USAGE: $prog <query>
|
USAGE: $prog <query>
|
||||||
-h show this help text
|
-h show this help text
|
||||||
-d download episode
|
-d download episode
|
||||||
-c cast anime
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,23 +37,19 @@ err () {
|
|||||||
search_anime () {
|
search_anime () {
|
||||||
# get anime name along with its id
|
# get anime name along with its id
|
||||||
search=$1
|
search=$1
|
||||||
curl -s "https://$site//search.html?keyword=$search" |
|
curl -s "https://$site//search.html?keyword=$search" | sed -n -E '
|
||||||
sed -n -E '
|
s_^[[:space:]]*<a href="/category/([^"]*)" title="([^"]*)".*_\1_p'
|
||||||
s_^[[:space:]]*<a href="/category/([^"]*)" title="([^"]*)".*_\1_p
|
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
search_eps () {
|
search_eps () {
|
||||||
# get available episodes for anime_id
|
# get available episodes for anime_id
|
||||||
anime_id=$1
|
anime_id=$1
|
||||||
|
|
||||||
curl -s "https://$site/category/$anime_id" |
|
curl -s "https://$site/category/$anime_id" | sed -n -E '
|
||||||
sed -n -E '
|
|
||||||
/^[[:space:]]*<a href="#" class="active" ep_start/{
|
/^[[:space:]]*<a href="#" class="active" ep_start/{
|
||||||
s/.* '\''([0-9]*)'\'' ep_end = '\''([0-9]*)'\''.*/\2/p
|
s/.* '\''([0-9]*)'\'' ep_end = '\''([0-9]*)'\''.*/\2/p
|
||||||
q
|
q
|
||||||
}
|
}'
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
embade_link() {
|
embade_link() {
|
||||||
@@ -68,17 +64,11 @@ embade_link() {
|
|||||||
|
|
||||||
decrypt_link() {
|
decrypt_link() {
|
||||||
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
||||||
|
|
||||||
#get the id from the url
|
|
||||||
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
||||||
|
|
||||||
#construct ajax parameters
|
|
||||||
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
||||||
iv='34323036393133333738303038313335'
|
iv='34323036393133333738303038313335'
|
||||||
ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
||||||
|
curl -s -H "X-Requested-With:XMLHttpRequest" -H "User-Agent:$agent" -H "Referer:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1
|
||||||
#send the request to the ajax url
|
|
||||||
curl -s -H 'x-requested-with:XMLHttpRequest' "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# get query
|
# get query
|
||||||
@@ -164,18 +154,14 @@ open_episode () {
|
|||||||
printf "%s\n" "$video_url"
|
printf "%s\n" "$video_url"
|
||||||
|
|
||||||
if [ $is_download -eq 0 ]; then
|
if [ $is_download -eq 0 ]; then
|
||||||
if [ $is_cast -eq 0 ]; then
|
|
||||||
([ -z $ep_choice_end ] &&
|
([ -z $ep_choice_end ] &&
|
||||||
setsid -f $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1)
|
setsid -f $player_fn --http-header-fields="User-Agent:$agent" --referrer="$embedded_url" "$video_url" >/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1)
|
||||||
else
|
|
||||||
catt cast "$video_url"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
printf "Downloading episode $episode ...\n"
|
printf "Downloading episode $episode ...\n"
|
||||||
# add 0 padding to the episode name
|
# add 0 padding to the episode name
|
||||||
episode=$(printf "%03d" $episode)
|
episode=$(printf "%03d" $episode)
|
||||||
{
|
{
|
||||||
aria2c -x 16 -s 16 --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" &&
|
aria2c -x 16 -s 16 -U "$agent" --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" &&
|
||||||
printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" ||
|
printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" ||
|
||||||
printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode"
|
printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode"
|
||||||
}
|
}
|
||||||
@@ -191,7 +177,6 @@ trap "printf '$c_reset';exit 1" INT HUP
|
|||||||
|
|
||||||
# option parsing
|
# option parsing
|
||||||
is_download=0
|
is_download=0
|
||||||
is_cast=0
|
|
||||||
while getopts 'hdc' OPT; do
|
while getopts 'hdc' OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
h)
|
h)
|
||||||
@@ -201,9 +186,6 @@ while getopts 'hdc' OPT; do
|
|||||||
d)
|
d)
|
||||||
is_download=1
|
is_download=1
|
||||||
;;
|
;;
|
||||||
c)
|
|
||||||
is_cast=1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|||||||
11
ani-new
11
ani-new
@@ -1,17 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
|
||||||
decrypt_link() {
|
decrypt_link() {
|
||||||
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
||||||
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
||||||
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
||||||
iv='34323036393133333738303038313335'
|
iv='34323036393133333738303038313335'
|
||||||
ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
||||||
curl -s -H 'x-requested-with:XMLHttpRequest' "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1
|
curl -s -H "X-Requested-With:XMLHttpRequest" -H "User-Agent:$agent" -H "Referer:https:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1
|
||||||
}
|
}
|
||||||
|
|
||||||
url=$(curl -s "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:")
|
url=$(curl -s -A "$agent" "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:")
|
||||||
[ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0
|
[ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0
|
||||||
refr=$(curl -s "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p')
|
refr=$(curl -s -A "$agent" "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p')
|
||||||
video=$(decrypt_link "$refr")
|
video=$(decrypt_link "$refr")
|
||||||
notify-send "Downloading $url"
|
notify-send "Downloading $url"
|
||||||
st -e aria2c --summary-interval=0 -x 16 -s 16 --referer="https:$refr" "$video" -o "$url.mp4" --download-result=hide && notify-send "Downloaded $url"
|
st -e aria2c --summary-interval=0 -x 16 -s 16 -U "$agent" --referer="https:$refr" "$video" --dir=MOVIES -o "$url.mp4" --download-result=hide && notify-send "Downloaded $url"
|
||||||
|
|||||||
4
nsfw
4
nsfw
@@ -3,7 +3,7 @@
|
|||||||
[ -z "$*" ] && printf "enter(paste) number or link:" && read -r num || num=$*
|
[ -z "$*" ] && printf "enter(paste) number or link:" && read -r num || num=$*
|
||||||
num=$(printf "$num" | cut -d\/ -f5)
|
num=$(printf "$num" | cut -d\/ -f5)
|
||||||
dir="$HOME/.cache/$num"
|
dir="$HOME/.cache/$num"
|
||||||
mkdir -pv $dir
|
mkdir -p $dir
|
||||||
trap "rm -rf $dir;exit 0" INT HUP
|
trap "rm -rf $dir;exit 0" INT HUP
|
||||||
pg=$(curl -s "https://nhentai.net/g/$num/1/" | sed -nE 's/.*pages">(.*)<\/span><.*/\1/p')
|
pg=$(curl -s "https://nhentai.net/g/$num/1/" | sed -nE 's/.*pages">(.*)<\/span><.*/\1/p')
|
||||||
echo "pages : $pg"
|
echo "pages : $pg"
|
||||||
@@ -19,4 +19,4 @@ echo "waiting 5 sec for pages to download completely"
|
|||||||
sleep 5
|
sleep 5
|
||||||
echo "concatenating pages to pdf"
|
echo "concatenating pages to pdf"
|
||||||
convert "$dir/*" "$num.pdf" && printf "saved pdf as $num.pdf\nopening pdf...enjoy 😏😏" && setsid -f xdg-open "$num.pdf"
|
convert "$dir/*" "$num.pdf" && printf "saved pdf as $num.pdf\nopening pdf...enjoy 😏😏" && setsid -f xdg-open "$num.pdf"
|
||||||
rm -rvf $dir
|
rm -rf $dir
|
||||||
|
|||||||
Reference in New Issue
Block a user