mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
dummy commit
This commit is contained in:
263
ani-cli
263
ani-cli
@@ -1,263 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# dependencies: grep sed curl video_player
|
||||
# video_player ( needs to be able to play urls )
|
||||
player_fn="mpv"
|
||||
prog="ani-cli"
|
||||
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_green="\033[1;32m"
|
||||
c_yellow="\033[1;33m"
|
||||
c_blue="\033[1;34m"
|
||||
c_magenta="\033[1;35m"
|
||||
c_cyan="\033[1;36m"
|
||||
c_reset="\033[0m"
|
||||
|
||||
help_text () {
|
||||
while IFS= read line; do
|
||||
printf "%s\n" "$line"
|
||||
done <<-EOF
|
||||
USAGE: $prog <query>
|
||||
-h show this help text
|
||||
-d download episode
|
||||
EOF
|
||||
}
|
||||
|
||||
die () {
|
||||
printf "$c_red%s$c_reset\n" "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
err () {
|
||||
printf "$c_red%s$c_reset\n" "$*" >&2
|
||||
}
|
||||
|
||||
search_anime () {
|
||||
# get anime name along with its id
|
||||
search=$1
|
||||
curl -s "https://$site//search.html?keyword=$search" | sed -n -E '
|
||||
s_^[[:space:]]*<a href="/category/([^"]*)" title="([^"]*)".*_\1_p'
|
||||
}
|
||||
|
||||
search_eps () {
|
||||
# get available episodes for anime_id
|
||||
anime_id=$1
|
||||
|
||||
curl -s "https://$site/category/$anime_id" | sed -n -E '
|
||||
/^[[:space:]]*<a href="#" class="active" ep_start/{
|
||||
s/.* '\''([0-9]*)'\'' ep_end = '\''([0-9]*)'\''.*/\2/p
|
||||
q
|
||||
}'
|
||||
}
|
||||
|
||||
embade_link() {
|
||||
# get the download page url
|
||||
anime_id=$1
|
||||
ep_no=$2
|
||||
|
||||
curl -s "https://$site/$anime_id-episode-$ep_no" |
|
||||
sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' |
|
||||
sed 's/^/https:/g'
|
||||
}
|
||||
|
||||
decrypt_link() {
|
||||
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
||||
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
||||
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
||||
iv='34323036393133333738303038313335'
|
||||
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
|
||||
}
|
||||
|
||||
# get query
|
||||
get_search_query () {
|
||||
if [ -z "$*" ]; then
|
||||
printf "Search Anime: "
|
||||
read -r query
|
||||
else
|
||||
query=$*
|
||||
fi
|
||||
}
|
||||
|
||||
#####################
|
||||
## Anime selection ##
|
||||
#####################
|
||||
|
||||
anime_selection () {
|
||||
search_results=$*
|
||||
menu_format_string='[%d] %s\n'
|
||||
menu_format_string_c1="$c_blue[$c_cyan%d$c_blue] $c_reset%s\n"
|
||||
menu_format_string_c2="$c_blue[$c_cyan%d$c_blue] $c_yellow%s$c_reset\n"
|
||||
|
||||
count=1
|
||||
while read anime_id; do
|
||||
# alternating colors for menu
|
||||
[ $((count % 2)) -eq 0 ] &&
|
||||
menu_format_string=$menu_format_string_c1 ||
|
||||
menu_format_string=$menu_format_string_c2
|
||||
|
||||
printf "$menu_format_string" "$count" "$anime_id"
|
||||
count=$((count+1))
|
||||
done <<-EOF
|
||||
$search_results
|
||||
EOF
|
||||
|
||||
# User input
|
||||
printf "$c_blue%s$c_green" "Enter number: "
|
||||
read choice
|
||||
printf "$c_reset"
|
||||
|
||||
# Check if input is a number
|
||||
[ "$choice" -eq "$choice" ] 2>/dev/null || die "Invalid number entered"
|
||||
|
||||
# Select respective anime_id
|
||||
count=1
|
||||
while read anime_id; do
|
||||
if [ $count -eq $choice ]; then
|
||||
selection_id=$anime_id
|
||||
break
|
||||
fi
|
||||
count=$((count+1))
|
||||
done <<-EOF
|
||||
$search_results
|
||||
EOF
|
||||
|
||||
[ -z "$selection_id" ] && die "Invalid number entered"
|
||||
|
||||
read last_ep_number <<-EOF
|
||||
$(search_eps "$selection_id")
|
||||
EOF
|
||||
}
|
||||
|
||||
##################
|
||||
## Ep selection ##
|
||||
##################
|
||||
|
||||
open_episode () {
|
||||
anime_id=$1
|
||||
episode=$2
|
||||
|
||||
if [ $episode -lt 1 ] || [ $episode -gt $last_ep_number ]; then
|
||||
err "Episode out of range"
|
||||
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||
read episode
|
||||
printf "$c_reset"
|
||||
fi
|
||||
|
||||
printf "\nGetting data for episode %d\n" $episode
|
||||
|
||||
embedded_url=$(embade_link "$anime_id" "$episode")
|
||||
video_url=$(decrypt_link "$embedded_url")
|
||||
printf "%s\n" "$embedded_url"
|
||||
printf "%s\n" "$video_url"
|
||||
|
||||
if [ $is_download -eq 0 ]; then
|
||||
([ -z $ep_choice_end ] &&
|
||||
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
|
||||
printf "Downloading episode $episode ...\n"
|
||||
# add 0 padding to the episode name
|
||||
episode=$(printf "%03d" $episode)
|
||||
{
|
||||
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_red}Download failed episode: %s${c_reset}\n" "$episode"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
############
|
||||
# Start Up #
|
||||
############
|
||||
|
||||
# to clear the colors when exited using SIGINT
|
||||
trap "printf '$c_reset';exit 1" INT HUP
|
||||
|
||||
# option parsing
|
||||
is_download=0
|
||||
while getopts 'hdc' OPT; do
|
||||
case $OPT in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
d)
|
||||
is_download=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
########
|
||||
# main #
|
||||
########
|
||||
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $is_download -eq 1 ] && printf "Range of episodes can be specified: start_number end_number\n"
|
||||
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||
read ep_choice_start ep_choice_end
|
||||
printf "$c_reset"
|
||||
|
||||
{ # checking input
|
||||
[ "$ep_choice_start" -eq "$ep_choice_start" ] 2>/dev/null || die "Invalid number entered"
|
||||
episodes=$ep_choice_start
|
||||
|
||||
if [ -n "$ep_choice_end" ]; then
|
||||
[ "$ep_choice_end" -eq "$ep_choice_end" ] 2>/dev/null || die "Invalid number entered"
|
||||
# create list of episodes to download/watch
|
||||
episodes=$(seq $ep_choice_start $ep_choice_end)
|
||||
fi
|
||||
}
|
||||
|
||||
for ep in $episodes
|
||||
do
|
||||
open_episode "$selection_id" "$ep"
|
||||
done
|
||||
episode=${ep_choice_end:-$ep_choice_start}
|
||||
|
||||
while :; do
|
||||
printf "\n${c_green}Currently playing %s episode ${c_cyan}%d/%d\n" "$selection_id" $episode $last_ep_number
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "n" "next episode"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "p" "previous episode"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "s" "select episode"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "r" "replay current episode"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_red%s$c_reset\n" "q" "exit"
|
||||
printf "${c_blue}Enter choice:${c_green} "
|
||||
read choice
|
||||
printf "$c_reset"
|
||||
case $choice in
|
||||
n)
|
||||
episode=$((episode + 1))
|
||||
open_episode "$selection_id" "$episode"
|
||||
;;
|
||||
p)
|
||||
episode=$((episode - 1))
|
||||
open_episode "$selection_id" "$episode"
|
||||
;;
|
||||
|
||||
s) printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||
read episode
|
||||
printf "$c_reset"
|
||||
[ "$episode" -eq "$episode" ] 2>/dev/null || die "Invalid number entered"
|
||||
open_episode "$selection_id" "$episode"
|
||||
;;
|
||||
|
||||
r)
|
||||
episode=$((episode))
|
||||
open_episode "$selection_id" "$episode"
|
||||
;;
|
||||
|
||||
q)
|
||||
break;;
|
||||
|
||||
*)
|
||||
err "invalid choice"
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
29
ani-new
29
ani-new
@@ -1,19 +1,26 @@
|
||||
#!/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() {
|
||||
ajax_url='https://gogoplay.io/encrypt-ajax.php'
|
||||
video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')
|
||||
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
|
||||
iv='34323036393133333738303038313335'
|
||||
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:https:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1
|
||||
secret_key='3633393736383832383733353539383139363339393838303830383230393037'
|
||||
iv='34373730343738393639343138323637'
|
||||
ajax_url="https://gogoplay5.com/encrypt-ajax.php"
|
||||
id=$(printf "%s" "$1" | sed -nE 's/.*id=(.*)&title.*/\1/p')
|
||||
ajax=$(printf "%s" "$id" | openssl enc -e -aes256 -K "$secret_key" -iv "$iv" | base64)
|
||||
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
|
||||
printf "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*' | head -4 | tail -1
|
||||
}
|
||||
|
||||
notify-send -t 1000 "parsing gogoanime.... please wait!!"
|
||||
url=$(curl -s -A "$agent" "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:")
|
||||
notify-send -t 1000 "parsing gogoplay5.... please wait!!"
|
||||
url=$(curl -s "https://gogoplay5.com" | sed -nE 's_.*<a href="/videos/([^"]*)">_\1_p' | dmenu -l 15 -p "Select anime:")
|
||||
[ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0
|
||||
refr=$(curl -s -A "$agent" "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p')
|
||||
refr=$(curl -s "https://gogoplay5.com/videos/$url" | sed -nE 's/.*iframe src="([^"]*)".*/\1/p')
|
||||
video=$(decrypt_link "$refr")
|
||||
choice=$(printf "download\nwatch" | dmenu -p "??" )
|
||||
[ "$choice" = "watch" ] && notify-send "Opening $url in mpv" && setsid -f mpv --referrer="https://gogoplay5.com" "$video" && exit 0
|
||||
notify-send "Downloading $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"
|
||||
case $video in
|
||||
*mp4*)
|
||||
st -e aria2c --summary-interval=0 -x 16 -s 16 --referer="https:$refr" "$video" --dir=movies -o "$url.mp4" --download-result=hide && notify-send "Downloaded $url" || exit 0;;
|
||||
*m3u*)
|
||||
st -e ffmpeg -loglevel error -stats -referer "https:$refr" -i "$video" -c copy "movies/$url.mp4" && notify-send "Downloaded $url" || exit 0;;
|
||||
esac
|
||||
|
||||
18
bat-status
18
bat-status
@@ -1,18 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
capacity=$(cat /sys/class/power_supply/BAT0/charge_full)
|
||||
voltage=$(cat /sys/class/power_supply/BAT0/voltage_now)
|
||||
percent=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
current=$(cat /sys/class/power_supply/BAT0/current_now)
|
||||
cap_now=$(cat /sys/class/power_supply/BAT0/charge_now)
|
||||
health="$(cat /sys/class/power_supply/BAT0/capacity_level)"
|
||||
stats="$(cat /sys/class/power_supply/BAT0/status)"
|
||||
|
||||
printf "Capacity : %.02f Ah\n" "$((capacity/1000))e-3"
|
||||
printf "Status : %s\n" "$health"
|
||||
printf "Percentage : %s\n" "$percent"
|
||||
printf "State : %s\n" "$stats"
|
||||
printf "Capacity now : %.02f Ah\n" "$((cap_now/1000))e-3"
|
||||
printf "Voltage now : %.02f V\n" "$((voltage/1000))e-3"
|
||||
printf "Current now : %.02f A\n" "$((current/1000))e-3"
|
||||
printf "Wattage now : %.02f W\n" "$(((voltage*current)/1000000))e-6"
|
||||
BIN
dmenu-5.0/dmenu
BIN
dmenu-5.0/dmenu
Binary file not shown.
@@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||
die("no font specified.");
|
||||
}
|
||||
|
||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||
* https://lists.suckless.org/dev/1701/30932.html
|
||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
||||
* and lots more all over the internet.
|
||||
*/
|
||||
FcBool iscol;
|
||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
||||
XftFontClose(drw->dpy, xfont);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
font = ecalloc(1, sizeof(Fnt));
|
||||
font->xfont = xfont;
|
||||
font->pattern = pattern;
|
||||
|
||||
BIN
dmenu-5.0/drw.o
BIN
dmenu-5.0/drw.o
Binary file not shown.
6
rss
6
rss
@@ -3,17 +3,17 @@
|
||||
#script for downloading latest anime episode via torrent using rss provided by website named "subsplease.org"
|
||||
#parsing rss file
|
||||
notify-send -t 2000 "Parsing SubsPlease RSS... Please Wait..."
|
||||
curl -s https://subsplease.org/rss/?r=1080 | tr "<" "\n" > $HOME/.cache/rss
|
||||
data=$(curl -s "https://subsplease.org/rss/?r=1080" | tr "<|>" "\n")
|
||||
|
||||
#extracting names and providing the menu for selecting particular title
|
||||
name=$(sed -n -e 's/title>\[.*Please\] \(.*\)/\1/p' .cache/rss | dmenu -l 25 -p "Search anime:")
|
||||
name=$(printf "%s" "$data" | sed -nE 's/^\[.*Please\] (.*)/\1/p' | dmenu -l 25 -p "Search anime:")
|
||||
[ -z "$name" ] && notify-send -u critical "Err.. Query empty" && exit 0
|
||||
|
||||
#extracting id from anime_name_[id].mkv
|
||||
id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p')
|
||||
|
||||
#finding the magnet link containing the exact pattern
|
||||
magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g')
|
||||
magnet=$(printf "%s" "$data" | grep "$id%" | sed 's/amp;//g')
|
||||
|
||||
#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here
|
||||
st -e $HOME/repos_scripts/torrent "$magnet" &
|
||||
|
||||
2
tor-cli
2
tor-cli
@@ -4,7 +4,7 @@ mkdir -p $HOME/.cache/pirokit
|
||||
query=$(printf "" | dmenu -p "Search Torrent: ")
|
||||
baseurl="https://www.1337xx.to"
|
||||
cachedir="$HOME/.cache/pirokit"
|
||||
query="$(sed 's/ /+/g' <<<$query)"
|
||||
query="$(sed 's/ /%20/g' <<<$query)"
|
||||
curl -s "$baseurl/search/$query/1/" > $cachedir/tmp.html
|
||||
|
||||
# Get Titles
|
||||
|
||||
4
youtube
4
youtube
@@ -26,8 +26,8 @@ part(){
|
||||
printf "${c_yellow}Enter End Point(hh:mm:ss)or(mm:ss):${c_cyan}"
|
||||
read end
|
||||
[ -z "$2" ] &&
|
||||
ffmpeg -i $(yt-dlp -f b --get-url "$video") -ss $start -to $end "$HOME/Videos/%(title)s.mp4" ||
|
||||
ffmpeg -i $(yt-dlp -f 'ba' --get-url "$video") -ss $start -t $end -map a -q:a 0 "$HOME/Music/%(title)s.mp3"
|
||||
ffmpeg -i $(yt-dlp -f b --get-url "$video") -ss $start -to $end "$HOME/Videos/$(date +%s).mp4" ||
|
||||
ffmpeg -i $(yt-dlp -f 'ba' --get-url "$video") -ss $start -t $end -map a -q:a 0 "$HOME/Music/$(date +%s).mp3"
|
||||
}
|
||||
|
||||
#program starts from here..
|
||||
|
||||
Reference in New Issue
Block a user