mirror of
https://github.com/CoolnsX/dra-cla.git
synced 2025-12-20 07:15:25 +05:30
chore:v2, history not backwords compatible
This commit is contained in:
145
dra-cla
145
dra-cla
@@ -18,7 +18,7 @@
|
|||||||
# Project repository: https://github.com/CoolnsX/dra-cla
|
# Project repository: https://github.com/CoolnsX/dra-cla
|
||||||
|
|
||||||
# Version number
|
# Version number
|
||||||
VERSION="1.1.0"
|
VERSION="2.0.0"
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
@@ -68,8 +68,8 @@ die () {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get the newest version of this script from github and replace it
|
||||||
update_script () {
|
update_script () {
|
||||||
# get the newest version of this script from github and replace it
|
|
||||||
update="$(curl -s "https://raw.githubusercontent.com/CoolnsX/dra-cla/main/dra-cla" | diff -u "$0" -)"
|
update="$(curl -s "https://raw.githubusercontent.com/CoolnsX/dra-cla/main/dra-cla" | diff -u "$0" -)"
|
||||||
if [ -z "$update" ]; then
|
if [ -z "$update" ]; then
|
||||||
inf "Script is up to date :)"
|
inf "Script is up to date :)"
|
||||||
@@ -82,8 +82,8 @@ update_script () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# checks if dependencies are present
|
||||||
dep_ch () {
|
dep_ch () {
|
||||||
# checks if dependencies are present
|
|
||||||
for dep; do
|
for dep; do
|
||||||
if ! command -v "$dep" >/dev/null ; then
|
if ! command -v "$dep" >/dev/null ; then
|
||||||
err "Program \"$dep\" not found. Please install it."
|
err "Program \"$dep\" not found. Please install it."
|
||||||
@@ -99,78 +99,73 @@ dep_ch () {
|
|||||||
# SEARCHING #
|
# SEARCHING #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
|
# gets drama names along with its id for search term
|
||||||
search_drama () {
|
search_drama () {
|
||||||
# get drama name along with its id for search term
|
search=$(printf '%s' "$1" | tr ' ' '-' )
|
||||||
search=$(printf '%s' "$1" | tr ' ' '+' )
|
curl -s "$base_url/search.html" -G -d "keyword=$search" |
|
||||||
curl -s "$base_url/search?type=movies&keyword=$search" |
|
sed -nE 's_^[[:space:]]*<a href="/videos/([^"]*)">_\1_p'
|
||||||
sed -n -E 's_^[[:space:]]*<a href="/drama-detail/([^"]*)".*_\1_p'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
search_for_unwatched () {
|
check_episode () {
|
||||||
# compares history with dramacool, only shows unfinished drama
|
tmp=$(printf "%s" "$1" | sed 's/[0-9]*.$//')
|
||||||
|
curl -s "$base_url/videos/$1" | sed -nE "s_^[[:space:]]*<a href.*videos/${tmp}(.*)\">_\1_p" | head -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
search_for_unwatched () { # todo: merge into search_history
|
||||||
search_results="$*"
|
search_results="$*"
|
||||||
while read -r drama_id; do
|
while read -r drama_id; do
|
||||||
temp=$(curl -s "$base_url/drama-detail/$drama_id")
|
current_ep_number=$(check_episode "$drama_id")
|
||||||
current_ep_number=$(printf "%s" "$temp" | sed -nE "s/.*href.*episode-(.*).html.*class.*img.*/\1/p" | head -1)
|
history_ep_number=$(printf "%s" "$drama_id" | grep -Po '\K\d+' | tail -n 1)
|
||||||
drama_id=$(printf "%s" "$temp" | sed -nE "s/.*href=\"\/(.*)-episode-${current_ep_number}.html.*class.*img.*/\1/p" | head -1)
|
[ -n "$current_ep_number" ] && [ "$current_ep_number" -ge "$history_ep_number" ] && printf '%s\n' "$drama_id"
|
||||||
history_ep_number=$(sed -n -E "s/${drama_id}\t//p" "$logfile")
|
|
||||||
[ "$current_ep_number" -ge "$history_ep_number" ] && printf '%s\n' "$drama_id"
|
|
||||||
done <<-EOF
|
done <<-EOF
|
||||||
$search_results
|
$search_results
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
search_another_drama () {
|
# compares history with gogoplay, only shows unfinished drama
|
||||||
tput clear
|
|
||||||
prompt "Search Drama"
|
|
||||||
query="$REPLY $REPLY2"
|
|
||||||
process_search
|
|
||||||
}
|
|
||||||
|
|
||||||
search_history () {
|
search_history () {
|
||||||
tput clear
|
tput clear
|
||||||
search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
search_results=$(cat "$logfile")
|
||||||
[ -z "$search_results" ] && die "History is empty"
|
[ -z "$search_results" ] && die "History is empty"
|
||||||
search_results=$(search_for_unwatched "$search_results")
|
search_results=$(search_for_unwatched "$search_results")
|
||||||
[ -z "$search_results" ] && die "No unwatched episodes"
|
[ -z "$search_results" ] && die "No unwatched episodes"
|
||||||
|
one_hist=$(printf '%s\n' "$search_results" | grep -e "$" -c)
|
||||||
|
[ "$one_hist" = 1 ] && select_first=1
|
||||||
drama_selection "$search_results"
|
drama_selection "$search_results"
|
||||||
ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
ep_choice_start=$(sed -n -E "s/${selection_id}(.*)/\1/p" "$logfile")
|
||||||
}
|
}
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# URL PROCESSING #
|
# URL PROCESSING #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
# get the download page url
|
||||||
get_dpage_link() {
|
get_dpage_link() {
|
||||||
# get the download page url
|
|
||||||
drama_id="$1"
|
drama_id="$1"
|
||||||
ep_no="$2"
|
ep_no="$2"
|
||||||
for params in "-episode-$ep_no.html" "-$ep_no.html" "-episode-$ep_no-1.html" "-camrip-episode-$ep_no.html"; do
|
|
||||||
drama_page=$(curl -s "$base_url/$drama_id$params")
|
curl -s "$base_url/videos/${drama_id}${ep_no}" | sed -nE 's_^[[:space:]]*<iframe src="([^"]*)".*_\1_p' |
|
||||||
printf '%s' "$drama_page" | grep -q '<h1 class="entry-title">404</h1>' || break
|
sed 's/^/https:/g'
|
||||||
done
|
|
||||||
printf '%s' "$drama_page" |
|
|
||||||
sed -n -E 's/.*class="Standard Server selected" rel="1" data-video="([^"]*)".*/\1/p' | sed 's/^/https:/g'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decrypt_link() {
|
decrypt_link() {
|
||||||
secret_key='3933343232313932343333393532343839373532333432393038353835373532'
|
secret_key='3933343232313932343333393532343839373532333432393038353835373532'
|
||||||
iv='39323632383539323332343335383235'
|
iv='39323632383539323332343335383235'
|
||||||
ajax_url="https://asianembed.io/encrypt-ajax.php"
|
ajax_url="$base_url/encrypt-ajax.php"
|
||||||
crypto_data=$(curl -s "$1" | sed -nE 's/.*data-value="([^"]*)".*/\1/p')
|
id=$(printf "%s" "$1" | sed -nE 's/.*id=(.*)&title.*/\1/p')
|
||||||
id=$(printf '%s' "$crypto_data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | cut -d '&' -f1)
|
|
||||||
|
|
||||||
#encrypt and create the final ajax
|
# encrypt new_id using iv and secret_key
|
||||||
ajax=$(printf "%s\010\016\003\010\t\003\004\t" "$id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
ajax=$(printf "%s\010\016\003\010\t\003\004\t" "$id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
||||||
|
#send request and get the data(most lamest way)
|
||||||
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
|
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
|
||||||
|
|
||||||
#decrypt the data to get final links
|
#decrypt the data to get final links
|
||||||
printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' |
|
printf '%s' "$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@:%_\+.~#?&\/\/=]*'
|
grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# chooses the link for the set quality
|
||||||
get_video_quality() {
|
get_video_quality() {
|
||||||
# chooses the link for the set quality
|
|
||||||
dpage_url="$1"
|
dpage_url="$1"
|
||||||
video_links=$(decrypt_link "$dpage_url")
|
video_links=$(decrypt_link "$dpage_url")
|
||||||
case $quality in
|
case $quality in
|
||||||
@@ -197,32 +192,33 @@ get_video_quality() {
|
|||||||
# TEXT OUTPUT #
|
# TEXT OUTPUT #
|
||||||
###############
|
###############
|
||||||
|
|
||||||
|
# display an error message to stderr (in red)
|
||||||
err () {
|
err () {
|
||||||
# display an error message to stderr (in red)
|
|
||||||
printf "\033[1;31m%s\033[0m\n" "$*" >&2
|
printf "\033[1;31m%s\033[0m\n" "$*" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# display an informational message (first argument in green, second in magenta)
|
||||||
inf () {
|
inf () {
|
||||||
# display an informational message (first argument in green, second in magenta)
|
|
||||||
printf "\033[1;32m%s \033[1;35m%s\033[0m\n" "$1" "$2"
|
printf "\033[1;32m%s \033[1;35m%s\033[0m\n" "$1" "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# prompts the user with message in $1-2 ($1 in blue, $2 in magenta) and saves the input to the variables in $REPLY and $REPLY2
|
||||||
prompt () {
|
prompt () {
|
||||||
# prompts the user with message in $1-2 ($1 in blue, $2 in magenta) and saves the input to the variables in $REPLY and $REPLY2
|
|
||||||
printf "\033[1;34m%s\033[1;35m%s\033[1;34m: \033[0m" "$1" "$2"
|
printf "\033[1;34m%s\033[1;35m%s\033[1;34m: \033[0m" "$1" "$2"
|
||||||
read -r REPLY REPLY2
|
read -r REPLY REPLY2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# displays an even (cyan) line of a menu line with $2 as an indicator in [] and $1 as the option
|
||||||
menu_line_even () {
|
menu_line_even () {
|
||||||
# displays an even (cyan) line of a menu line with $2 as an indicator in [] and $1 as the option
|
|
||||||
printf "\033[1;34m[\033[1;36m%s\033[1;34m] \033[1;36m%s\033[0m\n" "$2" "$1"
|
printf "\033[1;34m[\033[1;36m%s\033[1;34m] \033[1;36m%s\033[0m\n" "$2" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# displays an odd (yellow) line of a menu line with $2 as an indicator in [] and $1 as the option
|
||||||
menu_line_odd() {
|
menu_line_odd() {
|
||||||
# displays an odd (yellow) line of a menu line with $2 as an indicator in [] and $1 as the option
|
|
||||||
printf "\033[1;34m[\033[1;33m%s\033[1;34m] \033[1;33m%s\033[0m\n" "$2" "$1"
|
printf "\033[1;34m[\033[1;33m%s\033[1;34m] \033[1;33m%s\033[0m\n" "$2" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# display alternating menu lines (even and odd)
|
||||||
menu_line_alternate() {
|
menu_line_alternate() {
|
||||||
menu_line_parity=${menu_line_parity:-0}
|
menu_line_parity=${menu_line_parity:-0}
|
||||||
if [ "$menu_line_parity" -eq 0 ]; then
|
if [ "$menu_line_parity" -eq 0 ]; then
|
||||||
@@ -234,8 +230,8 @@ menu_line_alternate() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# displays a warning (red) line of a menu line with $2 as an indicator in [] and $1 as the option
|
||||||
menu_line_strong() {
|
menu_line_strong() {
|
||||||
# displays a warning (red) line of a menu line with $2 as an indicator in [] and $1 as the option
|
|
||||||
printf "\033[1;34m[\033[1;31m%s\033[1;34m] \033[1;31m%s\033[0m\n" "$2" "$1"
|
printf "\033[1;34m[\033[1;31m%s\033[1;34m] \033[1;31m%s\033[0m\n" "$2" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,10 +240,11 @@ menu_line_strong() {
|
|||||||
# INPUT PARSING #
|
# INPUT PARSING #
|
||||||
#################
|
#################
|
||||||
|
|
||||||
is_number () {
|
is_number () { # todo make this better, or make this inline
|
||||||
[ "$1" -eq "$1" ] 2>/dev/null || die 'Invalid number entered'
|
[ "$1" -eq "$1" ] 2>/dev/null || die 'Invalid number entered'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# only lets the user pass in case of a valid search
|
||||||
process_search () {
|
process_search () {
|
||||||
search_results=$(search_drama "$query")
|
search_results=$(search_drama "$query")
|
||||||
while [ -z "$search_results" ]; do
|
while [ -z "$search_results" ]; do
|
||||||
@@ -260,6 +257,7 @@ process_search () {
|
|||||||
episode_selection
|
episode_selection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# drama-selection menu handling function
|
||||||
drama_selection () {
|
drama_selection () {
|
||||||
count=1
|
count=1
|
||||||
while read -r drama_id; do
|
while read -r drama_id; do
|
||||||
@@ -268,7 +266,7 @@ drama_selection () {
|
|||||||
done <<-EOF
|
done <<-EOF
|
||||||
$search_results
|
$search_results
|
||||||
EOF
|
EOF
|
||||||
if [ -n "$ep_choice_to_start" ] && [ -n "$select_first" ]; then
|
if [ -n "$select_first" ]; then
|
||||||
tput clear
|
tput clear
|
||||||
choice=1
|
choice=1
|
||||||
elif [ -z "$ep_choice_to_start" ] || { [ -n "$ep_choice_to_start" ] && [ -z "$select_first" ]; }; then
|
elif [ -z "$ep_choice_to_start" ] || { [ -n "$ep_choice_to_start" ] && [ -z "$select_first" ]; }; then
|
||||||
@@ -293,18 +291,26 @@ drama_selection () {
|
|||||||
done <<-EOF
|
done <<-EOF
|
||||||
$search_results
|
$search_results
|
||||||
EOF
|
EOF
|
||||||
temp=$(curl -s "$base_url/drama-detail/$selection_id")
|
|
||||||
search_ep_result=$(printf "%s" "$temp" | sed -nE "s/.*href.*episode-(.*).html.*class.*img.*/\1/p" | head -1)
|
case $scrape in
|
||||||
selection_id=$(printf "%s" "$temp" | sed -nE "s/.*href=\"\/(.*)-episode-${search_ep_result}.html.*class.*img.*/\1/p" | head -1)
|
query)
|
||||||
|
select_ep_result=$(printf "%s" "$selection_id" | grep -Po '\K\d+' | tail -1);;
|
||||||
|
history)
|
||||||
|
select_ep_result=$(check_episode "$selection_id");;
|
||||||
|
*)
|
||||||
|
die "Unexpected scrape type";;
|
||||||
|
esac
|
||||||
read -r last_ep_number <<-EOF
|
read -r last_ep_number <<-EOF
|
||||||
$search_ep_result
|
$select_ep_result
|
||||||
EOF
|
EOF
|
||||||
|
selection_id=$(printf "%s" "$selection_id" | sed 's/[0-9]*.$//')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# gets episode number from user, makes sure it's in range, skips input if only one episode exists
|
||||||
episode_selection () {
|
episode_selection () {
|
||||||
# using get_dpage_link to get confirmation from episode 0 if it exists,else first_ep_number becomes "1"
|
# using get_dpage_link to get confirmation from episode 0 if it exists,else first_ep_number becomes "1"
|
||||||
first_ep_number=0
|
first_ep_number=0
|
||||||
result=$(get_dpage_link "$drama_id" "$first_ep_number")
|
result=$(get_dpage_link "$selection_id" "$first_ep_number")
|
||||||
[ -z "$result" ] && first_ep_number=1
|
[ -z "$result" ] && first_ep_number=1
|
||||||
if [ "$last_ep_number" -gt "$first_ep_number" ]; then
|
if [ "$last_ep_number" -gt "$first_ep_number" ]; then
|
||||||
inf "Range of episodes can be specified: start_number end_number"
|
inf "Range of episodes can be specified: start_number end_number"
|
||||||
@@ -340,8 +346,8 @@ episode_selection () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# checks if input is number, creates $episodes from $ep_choice_start and $ep_choice_end
|
||||||
check_input() {
|
check_input() {
|
||||||
# checks if input is number, creates $episodes from $ep_choice_start and $ep_choice_end
|
|
||||||
is_number "$ep_choice_start"
|
is_number "$ep_choice_start"
|
||||||
episodes=$ep_choice_start
|
episodes=$ep_choice_start
|
||||||
if [ -n "$ep_choice_end" ]; then
|
if [ -n "$ep_choice_end" ]; then
|
||||||
@@ -356,23 +362,23 @@ check_input() {
|
|||||||
# VIDEO PLAYBACK #
|
# VIDEO PLAYBACK #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
append_history () {
|
append_history () { # todo: unite this with the temporary histfile writing
|
||||||
grep -q -w "${selection_id}" "$logfile" || printf "%s\t%s\n" "$selection_id" $((episode+1)) >> "$logfile"
|
grep -q "${selection_id}" "$logfile" || printf "%s%s\n" "$selection_id" $((episode+1)) >> "$logfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# opens selected episodes one-by-one
|
||||||
open_selection() {
|
open_selection() {
|
||||||
# opens selected episodes one-by-one
|
|
||||||
for ep in $episodes; do
|
for ep in $episodes; do
|
||||||
open_episode "$selection_id" "$ep"
|
open_episode "$selection_id" "$ep"
|
||||||
done
|
done
|
||||||
episode=${ep_choice_end:-$ep_choice_start}
|
episode=${ep_choice_end:-$ep_choice_start}
|
||||||
}
|
}
|
||||||
|
|
||||||
open_episode () {
|
open_episode () { # todo move input checking
|
||||||
drama_id="$1"
|
drama_id="$1"
|
||||||
episode="$2"
|
episode="$2"
|
||||||
# cool way of clearing screen
|
|
||||||
tput clear
|
#tput clear
|
||||||
# checking if episode is in range
|
# checking if episode is in range
|
||||||
while [ "$episode" -gt "$last_ep_number" ] || [ -z "$episode" ]; do
|
while [ "$episode" -gt "$last_ep_number" ] || [ -z "$episode" ]; do
|
||||||
is_number "$ep_choice_start"
|
is_number "$ep_choice_start"
|
||||||
@@ -384,7 +390,6 @@ open_episode () {
|
|||||||
prompt "Choose episode" "[$first_ep_number-$last_ep_number]"
|
prompt "Choose episode" "[$first_ep_number-$last_ep_number]"
|
||||||
episode="$REPLY $REPLY2"
|
episode="$REPLY $REPLY2"
|
||||||
done
|
done
|
||||||
#processing half episodes
|
|
||||||
if [ "$half_ep" -eq 1 ]; then
|
if [ "$half_ep" -eq 1 ]; then
|
||||||
temp_ep="$episode"
|
temp_ep="$episode"
|
||||||
episode="${episode}-5"
|
episode="${episode}-5"
|
||||||
@@ -392,18 +397,17 @@ open_episode () {
|
|||||||
inf "Getting data for episode $episode"
|
inf "Getting data for episode $episode"
|
||||||
# decrypting url
|
# decrypting url
|
||||||
dpage_link=$(get_dpage_link "$drama_id" "$episode")
|
dpage_link=$(get_dpage_link "$drama_id" "$episode")
|
||||||
printf "%s" "$dpage_link"
|
printf "%s\n" "$dpage_link"
|
||||||
video_url=$(get_video_quality "$dpage_link")
|
video_url=$(get_video_quality "$dpage_link")
|
||||||
printf "%s" "$video_url"
|
printf "%s\n" "$video_url"
|
||||||
if [ "$half_ep" -eq 1 ]; then
|
if [ "$half_ep" -eq 1 ]; then
|
||||||
episode="$temp_ep"
|
episode="$temp_ep"
|
||||||
half_ep=0
|
half_ep=0
|
||||||
fi
|
fi
|
||||||
# Download or play episodes
|
|
||||||
if [ "$is_download" -eq 0 ]; then
|
if [ "$is_download" -eq 0 ]; then
|
||||||
# write drama and episode number and save to temporary history
|
# write drama and episode number and save to temporary history
|
||||||
sed -E "
|
sed -E "
|
||||||
s/^${selection_id}\t[0-9]+/${selection_id}\t$((episode+1))/
|
s/^${selection_id}[0-9]*/${selection_id}$((episode+1))/
|
||||||
" "$logfile" > "${logfile}.new"
|
" "$logfile" > "${logfile}.new"
|
||||||
[ "$PID" -ne 0 ] && kill "$PID" >/dev/null 2>&1
|
[ "$PID" -ne 0 ] && kill "$PID" >/dev/null 2>&1
|
||||||
[ -z "$video_url" ] && die "Video URL not found"
|
[ -z "$video_url" ] && die "Video URL not found"
|
||||||
@@ -428,11 +432,11 @@ open_episode () {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
PID=$!
|
PID=$!
|
||||||
|
# overwrite history with temporary history
|
||||||
mv "${logfile}.new" "$logfile"
|
mv "${logfile}.new" "$logfile"
|
||||||
else
|
else
|
||||||
mkdir -p "$download_dir"
|
mkdir -p "$download_dir"
|
||||||
inf "Downloading episode $episode ..."
|
inf "Downloading episode $episode ..."
|
||||||
# add 0 padding to the episode name
|
|
||||||
episode=$(printf "%03d" "$episode")
|
episode=$(printf "%03d" "$episode")
|
||||||
{
|
{
|
||||||
if aria2c -x 16 -s 16 --referer="$dpage_link" "$video_url" --dir="$download_dir" -o "${drama_id}-${episode}.mp4" --download-result=hide ; then
|
if aria2c -x 16 -s 16 --referer="$dpage_link" "$video_url" --dir="$download_dir" -o "${drama_id}-${episode}.mp4" --download-result=hide ; then
|
||||||
@@ -448,7 +452,7 @@ open_episode () {
|
|||||||
# START UP #
|
# START UP #
|
||||||
############
|
############
|
||||||
|
|
||||||
# to clear the colors when exited using SIGINT
|
# clears the colors and deletes temporary logfile when exited using SIGINT
|
||||||
trap 'printf "\033[0m";[ -f "$logfile".new ] && rm "$logfile".new;exit 1' INT HUP
|
trap 'printf "\033[0m";[ -f "$logfile".new ] && rm "$logfile".new;exit 1' INT HUP
|
||||||
|
|
||||||
# default options
|
# default options
|
||||||
@@ -516,17 +520,14 @@ while getopts 'vq:dp:chDUVa:' OPT; do
|
|||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
# check for main dependencies
|
|
||||||
dep_ch "curl" "sed" "grep" "git" "openssl"
|
dep_ch "curl" "sed" "grep" "git" "openssl"
|
||||||
|
|
||||||
# check for optional dependencies
|
|
||||||
if [ "$is_download" -eq 0 ]; then
|
if [ "$is_download" -eq 0 ]; then
|
||||||
dep_ch "$player_fn"
|
dep_ch "$player_fn"
|
||||||
else
|
else
|
||||||
dep_ch "aria2c"
|
dep_ch "aria2c"
|
||||||
fi
|
fi
|
||||||
# dramacool likes to change domains but keep the olds as redirects
|
|
||||||
base_url="https://dramacool.fo"
|
base_url="https://asianembed.io"
|
||||||
case $scrape in
|
case $scrape in
|
||||||
query)
|
query)
|
||||||
if [ -z "$*" ]; then
|
if [ -z "$*" ]; then
|
||||||
@@ -545,7 +546,7 @@ case $scrape in
|
|||||||
search_history
|
search_history
|
||||||
[ "$REPLY" = "q" ] && exit 0
|
[ "$REPLY" = "q" ] && exit 0
|
||||||
first_ep_number=0
|
first_ep_number=0
|
||||||
result=$(get_dpage_link "$drama_id" "$first_ep_number")
|
result=$(get_dpage_link "$selection_id" "$first_ep_number")
|
||||||
[ -z "$result" ] && first_ep_number=1
|
[ -z "$result" ] && first_ep_number=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -576,7 +577,6 @@ if [ -z "$select_first" ]; then
|
|||||||
menu_line_alternate "select quality (current: $quality)" "b"
|
menu_line_alternate "select quality (current: $quality)" "b"
|
||||||
menu_line_strong "exit" "q"
|
menu_line_strong "exit" "q"
|
||||||
prompt "Enter choice"
|
prompt "Enter choice"
|
||||||
# process user choice
|
|
||||||
choice="$REPLY"
|
choice="$REPLY"
|
||||||
case $choice in
|
case $choice in
|
||||||
n)
|
n)
|
||||||
@@ -599,7 +599,10 @@ if [ -z "$select_first" ]; then
|
|||||||
ep_choice_end=
|
ep_choice_end=
|
||||||
;;
|
;;
|
||||||
a)
|
a)
|
||||||
search_another_drama
|
tput clear
|
||||||
|
prompt "Search Drama"
|
||||||
|
query="$REPLY $REPLY2"
|
||||||
|
process_search
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
search_history
|
search_history
|
||||||
|
|||||||
Reference in New Issue
Block a user