fix: dynamic drama_id

This commit is contained in:
CoolnsX
2022-03-07 21:57:33 +05:30
parent a1a6c4be14
commit 2becd94995
2 changed files with 10 additions and 10 deletions

View File

@@ -7,6 +7,7 @@
<a href="https://discord.gg/A4c5UWNk"><img src="https://invidget.switchblade.xyz/A4c5UWNk"></a>
<br>
<a href="https://github.com/CoolnsX"><img src="https://img.shields.io/badge/maintainer-CoolnsX-blue"></a>
<a href="https://github.com/iamchokerman"><img src="https://img.shields.io/badge/maintainer-iamchokerman-blue"></a>
</p>

19
dra-cla
View File

@@ -18,7 +18,7 @@
# Project repository: https://github.com/CoolnsX/dra-cla
# Version number
VERSION="1.0.1"
VERSION="1.1.0"
#######################
@@ -106,18 +106,13 @@ search_drama () {
sed -n -E 's_^[[:space:]]*<a href="/drama-detail/([^"]*)".*_\1_p'
}
search_eps () {
# get available episodes for drama_id
drama_id="$1"
curl -s "$base_url/drama-detail/$drama_id" |
sed -nE "s/.*$id.*episode-(.*).html.*/\1/p" | head -1
}
search_for_unwatched () {
# compares history with dramacool, only shows unfinished drama
search_results="$*"
while read -r drama_id; do
current_ep_number=$(search_eps "$drama_id")
temp=$(curl -s "$base_url/drama-detail/$drama_id")
current_ep_number=$(printf "%s" "$temp" | sed -nE "s/.*href.*episode-(.*).html.*class.*img.*/\1/p" | head -1)
drama_id=$(printf "%s" "$temp" | sed -nE "s/.*href=\"\/(.*)-episode-${current_ep_number}.html.*class.*img.*/\1/p" | head -1)
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
@@ -298,7 +293,9 @@ drama_selection () {
done <<-EOF
$search_results
EOF
search_ep_result=$(search_eps "$selection_id")
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)
selection_id=$(printf "%s" "$temp" | sed -nE "s/.*href=\"\/(.*)-episode-${search_ep_result}.html.*class.*img.*/\1/p" | head -1)
read -r last_ep_number <<-EOF
$search_ep_result
EOF
@@ -395,7 +392,9 @@ open_episode () {
inf "Getting data for episode $episode"
# decrypting url
dpage_link=$(get_dpage_link "$drama_id" "$episode")
printf "%s" "$dpage_link"
video_url=$(get_video_quality "$dpage_link")
printf "%s" "$video_url"
if [ "$half_ep" -eq 1 ]; then
episode="$temp_ep"
half_ep=0