Never before had a small typo like this one caused so much damage.
This commit is contained in:
82
grpoppro
82
grpoppro
@@ -41,12 +41,15 @@ function message {
|
||||
|
||||
# Standard curl request
|
||||
function curlRequest {
|
||||
response="$(curl -s -L -c "$GRPOPPRO_COOKIE_FILE" -b "$GRPOPPRO_COOKIE_FILE" \
|
||||
response="$(curl -s -L \
|
||||
-c "$GRPOPPRO_COOKIE_FILE" \
|
||||
-b "$GRPOPPRO_COOKIE_FILE" \
|
||||
-A "$USER_AGENT" \
|
||||
-H "$ACCEPT" \
|
||||
-H "$ACCEPT_LANGUAGE" \
|
||||
-H "$CONNECTION" \
|
||||
-H "$UP_IN_REQ" \
|
||||
--compressed \
|
||||
"$@"
|
||||
)"
|
||||
exit_code="$?"
|
||||
@@ -75,8 +78,17 @@ function getFzfForTermux {
|
||||
# Retrieve IMDb ID
|
||||
function getIMDBID {
|
||||
response="$(curlRequest "https://www.imdb.com/find/?q=$title")"
|
||||
imdbid="$(echo "$response" | grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' | grep 'href="/title/'| head -n1 | sed -e 's/href="\/title\///' -e 's/\/?.*//' -e 's/^ //')"
|
||||
# imdbid="$(curl -s "http://imdb.konsthol.eu/find?q=$title" | grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' | grep title | head -n1 | sed -e 's/^ //' -e 's/href="\/title\///' -e 's/"//')"
|
||||
imdbid="$(echo "$response" \
|
||||
| grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' \
|
||||
| grep 'href="/title/' \
|
||||
| head -n1 \
|
||||
| sed -e 's/href="\/title\///' -e 's/\/?.*//' -e 's/^ //'
|
||||
)"
|
||||
# response="$(curlRequest "http://imdb.konsthol.eu/find?q=$title")"
|
||||
# imdbid="$(echo "$response" \
|
||||
# | grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' \
|
||||
# | grep title | head -n1 \
|
||||
# | sed -e 's/^ //' -e 's/href="\/title\///' -e 's/"//')"
|
||||
if ! [[ "$imdbid" == *"tt"* ]]; then
|
||||
message "Film or show not found in imdb"
|
||||
exit 0
|
||||
@@ -98,13 +110,22 @@ function getInternalID {
|
||||
message "No file found"
|
||||
exit 0
|
||||
fi
|
||||
internalid="$(echo "$response" | grep news_id | awk '{print $5}' | awk -F\' '{print $2}')"
|
||||
internalid="$(echo "$response" \
|
||||
| grep news_id \
|
||||
| awk '{print $5}' \
|
||||
| awk -F\' '{print $2}'
|
||||
)"
|
||||
}
|
||||
|
||||
# Retrieve movie stream URL
|
||||
function getMovieStreamUrl {
|
||||
PHPSESSID="$(grep 'PHPSESSID' "$GRPOPPRO_COOKIE_FILE" | awk '{print $NF}')"
|
||||
response="$(curl -s -L -c "$GRPOPPRO_COOKIE_FILE" -b "$GRPOPPRO_COOKIE_FILE" "$apiurl/engine/ajax/controller.php" --compressed -X POST \
|
||||
response="$(curl -s -L \
|
||||
-c "$GRPOPPRO_COOKIE_FILE" \
|
||||
-b "$GRPOPPRO_COOKIE_FILE" \
|
||||
"$apiurl/engine/ajax/controller.php" \
|
||||
--compressed \
|
||||
-X POST \
|
||||
-A "$USER_AGENT" \
|
||||
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
|
||||
-H "$ACCEPT_LANGUAGE" \
|
||||
@@ -123,7 +144,10 @@ function getMovieStreamUrl {
|
||||
-H 'TE: trailers' \
|
||||
--data-raw "mod=players&news_id=$internalid"
|
||||
)"
|
||||
streamurl="$(echo "$response" | sed 's/\\//g' | grep -oP 'file:"\K[^"]+')"
|
||||
streamurl="$(echo "$response" \
|
||||
| sed 's/\\//g' \
|
||||
| grep -oP 'file:"\K[^"]+'
|
||||
)"
|
||||
}
|
||||
|
||||
# Stream the video
|
||||
@@ -175,15 +199,27 @@ function menuSearch {
|
||||
getInternalID "$simpleurl"
|
||||
response="$(curlRequest "$apiurl/uploads/playlists/$internalid.txt")"
|
||||
echo "$response" > "$GRPOPPRO_PLAYLIST_FILE"
|
||||
title="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | head -n1 | awk -F/ '{print $(NF-1)}')"
|
||||
title="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
|
||||
| head -n1 \
|
||||
| awk -F/ '{print $(NF-1)}'
|
||||
)"
|
||||
title="${title//_/ }"
|
||||
title="${title//-/ }"
|
||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | eval "$menu"\""$title" \")"
|
||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
|
||||
| awk -F\" '{print $8}' \
|
||||
| awk -F/ '{print $NF}' \
|
||||
| awk -F. '{print $1}' \
|
||||
| eval "$menu"\""$title" \"
|
||||
)"
|
||||
if [[ -z "$seasonEpisode" ]]; then
|
||||
message "Nothing Selected"
|
||||
exit 0
|
||||
fi
|
||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
|
||||
| grep "${seasonEpisode}" \
|
||||
| head -n1 \
|
||||
| awk -F\" '{print $8}'
|
||||
)"
|
||||
dumpData "$title" "$seasonEpisode"
|
||||
play
|
||||
resume
|
||||
@@ -201,12 +237,22 @@ function resume {
|
||||
while true
|
||||
do
|
||||
sourceData
|
||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | sed -n -e "0,/$lastSeasonEpisodePlayed/!p" | eval "$menu"\""$title" \")"
|
||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
|
||||
| awk -F\" '{print $8}' \
|
||||
| awk -F/ '{print $NF}' \
|
||||
| awk -F. '{print $1}' \
|
||||
| sed -n -e "0,/$lastSeasonEpisodePlayed/!p" \
|
||||
| eval "$menu"\""$title" \"
|
||||
)"
|
||||
if [[ -z "$seasonEpisode" ]]; then
|
||||
message "Nothing Selected"
|
||||
exit 0
|
||||
fi
|
||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
|
||||
| grep "${seasonEpisode}" \
|
||||
| head -n1 \
|
||||
| awk -F\" '{print $8}'
|
||||
)"
|
||||
dumpData "$title" "$seasonEpisode"
|
||||
play
|
||||
done
|
||||
@@ -219,13 +265,16 @@ function resumeSeries {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
resume_series=$(awk -F'|' '{print $1}' "$GRPOPPRO_HISTORY_FILE" | sort | uniq | eval "$menu"\"Select Series \")
|
||||
resume_series="$(awk -F'|' '{print $1}' "$GRPOPPRO_HISTORY_FILE" \
|
||||
| sort \
|
||||
| uniq \
|
||||
| eval "$menu"\"Select Series \"
|
||||
)"
|
||||
if [[ -z "$resume_series" ]]; then
|
||||
message "No series selected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# resume_episode=$(grep "^$resume_series|" "$GRPOPPRO_HISTORY_FILE" | awk -F'|' '{print $2}' | eval "$menu"\"Select Episode \")
|
||||
resume_episode="$(grep "^$resume_series|" "$GRPOPPRO_HISTORY_FILE" | awk -F'|' '{print $2}')"
|
||||
if [[ -n "$resume_episode" ]]; then
|
||||
message "Continuing $resume_series from $resume_episode"
|
||||
@@ -321,7 +370,12 @@ if [[ "$#" -eq 3 ]]; then
|
||||
season="$2"
|
||||
episode="$3"
|
||||
response="$(curlRequest "$apiurl/uploads/playlists/$internalid.txt")"
|
||||
streamurl="$(echo "$response" | grep "mp4" | grep "${season}x${episode}" | head -n1 | awk -F\" '{print $8}')"
|
||||
streamurl="$(echo "$response" \
|
||||
| grep "mp4" \
|
||||
| grep "${season}x${episode}" \
|
||||
| head -n1 \
|
||||
| awk -F\" '{print $8}'
|
||||
)"
|
||||
message "Loading $title at season $season on episode $episode"
|
||||
play
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user