clever999
Stamm User
- Registriert
- 5. Oktober 2011
- Beiträge
- 1.183
- Reaktionspunkte
- 2.188
- Punkte
- 1.860
Hallo Zusammen,
habe mal einen Downloader, unter Ubuntu, für VOD und Serien erstellt. Mal schauen evtl nehme ich es in xtreammulti mit rein.
nano /home/stalkerdownloader.sh (spoiler einfügen)
chmod +x /home/stalkerdownloader.sh
/home/stalkerdownloader.sh
Der Player funktioniert natürlich nur mit Desktop ;-)
Happy Viewing
CleVer
habe mal einen Downloader, unter Ubuntu, für VOD und Serien erstellt. Mal schauen evtl nehme ich es in xtreammulti mit rein.
nano /home/stalkerdownloader.sh (spoiler einfügen)
Bash:
#!/bin/bash
# ╔═════════════════════════════════════════════════════════════╗
# ║ IPTV / Stalker Portal Script – Live, VOD & Serien ║
# ║ Interaktive Auswahl + ffplay/mpv + ESC-Handling by clever ║
# ╚═════════════════════════════════════════════════════════════╝
# === Grundeinstellungen ===
MAC="00:1A:79:ab:f4:af"
URL="http://global4k.info:8080"
UA="Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) MAG250 stbapp ver: 4 rev: 2721 Mobile Safari/533.3"
COOKIE="mac=$MAC; stb_lang=en; timezone=Europe/Amsterdam;"
token=""
PLAYER="ffplay -hide_banner"
# ==========================================================
# 💡 Interaktive Änderung von URL & MAC
# ==========================================================
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📡 IPTV Portal Zugriff"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
read -p "Aktuelle URL ist '$URL' – neue eingeben oder Enter: " input_url
if [[ -n "$input_url" ]]; then
URL="$input_url"
fi
read -p "Aktuelle MAC ist '$MAC' – neue eingeben oder Enter: " input_mac
if [[ -n "$input_mac" ]]; then
MAC="$input_mac"
fi
COOKIE="mac=$MAC; stb_lang=en; timezone=Europe/Amsterdam;"
# Download-Ordner prüfen
if [ ! -d "Download" ]; then
mkdir Download
fi
# Abhängigkeiten prüfen
for pkg in curl fzf ffmpeg; do
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
echo "→ Installiere $pkg ..."
sudo apt-get install -y "$pkg"
else
echo "✔ $pkg ist bereits installiert."
fi
done
# ==========================================================
# 🔐 Authentifizierung
# ==========================================================
get_token() {
echo "🔑 Authentifiziere mit Portal..."
response=$(curl -s -i -H "User-Agent: $UA" -H "Cookie: $COOKIE" \
"$URL/portal.php?type=stb&action=handshake&JsHttpRequest=1-xml")
token=$(echo "$response" | grep -oP '(?<="token":")[^"]*')
[[ -z "$token" ]] && { echo "❌ Kein Token erhalten!"; exit 1; }
echo "✅ Token: $token"
}
# ==========================================================
# 📡 API-Funktionen
# ==========================================================
get_live_categories() {
curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=itv&action=get_genres&JsHttpRequest=1-xml"
}
get_live_channels() {
local genre_id="$1"
local results=""
for ((page=1; page<=200; page++)); do
echo "📡 Lade Sender Seite $page..." >&2
resp=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=itv&action=get_ordered_list&genre=$genre_id&p=$page&JsHttpRequest=1-xml")
[[ "$(echo "$resp" | jq -c '.js.data')" == "[]" ]] && { echo "✅ Alle Sender geladen."; break; }
results+=$(echo "$resp" | jq -r '.js.data[]? | "\(.name)\t\(.cmd)"')$'\n'
done
echo "$results"
}
get_vod_categories() {
curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=get_categories&JsHttpRequest=1-xml"
}
get_vod_list() {
local cat="$1"
local results=""
for ((page=1; page<=10000; page++)); do
echo "🎬 Lade Filme Seite $page..." >&2
resp=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=get_ordered_list&category=$cat&p=$page&JsHttpRequest=1-xml")
[[ "$(echo "$resp" | jq -c '.js.data')" == "[]" ]] && { echo ""; break; }
results+=$(echo "$resp" | jq -r '.js.data[]? | "\(.name)\t\(.cmd)"')$'\n'
done
echo "$results"
}
get_series_categories() {
curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=series&action=get_categories&JsHttpRequest=1-xml"
}
get_series_list() {
local cat="$1"
local results=""
for ((page=1; page<=50; page++)); do
echo "🎞️ Lade Serien Seite $page..." >&2
resp=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=series&action=get_ordered_list&category=$cat&p=$page&JsHttpRequest=1-xml")
[[ "$(echo "$resp" | jq -c '.js.data')" == "[]" ]] && { echo ""; break; }
results+=$(echo "$resp" | jq -r '.js.data[]? | "\(.name)|\(.id)"')$'\n'
done
echo "$results"
}
get_episodes() {
local series_id="$1"
local results=""
for ((page=1; page<=50; page++)); do
echo "🎬 Lade Episoden Seite $page..." >&2
resp=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=series&action=get_ordered_list&movie_id=$series_id&category=$series_id&genre=*&season_id=0&episode_id=0&p=$page&JsHttpRequest=1-xml")
[[ "$(echo "$resp" | jq -c '.js.data')" == "[]" ]] && { echo ""; break; }
results+=$(echo "$resp" | jq -r '
.js.data[]? as $season
| $season.series[]? as $ep_id
| "\($ep_id)\t\($season.cmd)\t\($season.path) \($season.name) Episode \($ep_id)\t\($ep_id)"
')$'\n'
done
echo "$results"
}
# ==========================================================
# ▶️ Wiedergabe
# ==========================================================
play_media() {
local cmd="$1"
link=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=itv&action=create_link&cmd=$(echo "$cmd" | sed 's#ffmpeg ##g')&JsHttpRequest=1-xml")
ffplay_cmd=$(echo "$link" | jq -r '.js.cmd' | sed 's#ffmpeg ##g')
[[ -z "$ffplay_cmd" ]] && { echo "❌ Kein Stream-Link!"; return 1; }
$PLAYER "$ffplay_cmd" >/dev/null 2>&1
echo "⏹️ Stream beendet"
}
play_vod() {
local cmd="$1"
link=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=create_link&cmd=$(echo "$cmd" | sed 's#ffmpeg ##g')&JsHttpRequest=1-xml")
ffplay_cmd=$(echo "$link" | jq -r '.js.cmd' | sed 's#ffmpeg ##g')
[[ -z "$ffplay_cmd" ]] && { echo "❌ Kein Stream-Link!"; return 1; }
$PLAYER "$ffplay_cmd" >/dev/null 2>&1
echo "⏹️ Stream beendet"
}
download_vod() {
local cmd="$1"
local title="$2"
# Stream-Link abrufen
link=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=create_link&cmd=$(echo "$cmd" | sed 's#ffmpeg ##g')&JsHttpRequest=1-xml")
ffplay_cmd=$(echo "$link" | jq -r '.js.cmd' | sed 's#ffmpeg ##g')
[[ -z "$ffplay_cmd" ]] && { echo "❌ Kein Stream-Link!"; return 1; }
echo "⏬ Download in $title..."
curl -L "$ffplay_cmd" -o Download/"$title"
echo "⏹️ Download $title beendet"
}
play_series() {
local season_cmd="$1"
local ep_num="$2"
link=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=create_link&cmd=$season_cmd&series=$ep_num&JsHttpRequest=1-xml")
ffplay_cmd=$(echo "$link" | jq -r '.js.cmd' | sed 's#ffmpeg ##g')
[[ -z "$ffplay_cmd" ]] && { echo "❌ Kein Stream-Link!"; return 1; }
$PLAYER "$ffplay_cmd" >/dev/null 2>&1
echo "⏹️ Stream beendet"
}
download_series() {
local season_cmd="$1"
local ep_num="$2"
local ep_title="$3"
link=$(curl -s -H "User-Agent: $UA" -H "Cookie: $COOKIE" -H "Authorization: Bearer $token" \
"$URL/portal.php?type=vod&action=create_link&cmd=$season_cmd&series=$ep_num&JsHttpRequest=1-xml")
ffplay_cmd=$(echo "$link" | jq -r '.js.cmd' | sed 's#ffmpeg ##g')
[[ -z "$ffplay_cmd" ]] && { echo "❌ Kein Stream-Link!"; return 1; }
echo "⏬ Download in $title..."
echo $ffplay_cmd
curl -L "$ffplay_cmd" -o Download/"$ep_title"
echo "⏹️ Download $title beendet"
}
# ==========================================================
# 🧭 ESC-fähige Menüs mit alphabetischer Sortierung der Items
# ==========================================================
menu_live() {
livecats=$(get_live_categories | jq -r '.js[] | "\(.id)|\(.title)"' | sed '/|All/d')
while true; do
selected=$(echo "$livecats" | fzf --prompt="📺 LiveTV Kategorie (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$selected" ]] && continue
genre_id="${selected%%|*}"
channels=$(get_live_channels "$genre_id")
[[ -z "$channels" ]] && { echo "🚫 Keine Sender."; continue; }
# ⚠️ Keine Sortierung, LiveTV bleibt in Portal-Reihenfolge
while true; do
sel=$(echo "$channels" | fzf --delimiter=$'\t' --with-nth=1 --prompt="📻 Sender auswählen (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$sel" ]] && continue
cmd=$(echo "$sel" | cut -f2)
play_media "$cmd"
done
done
}
menu_vod() {
vodcats=$(get_vod_categories | jq -r '.js[] | "\(.id)|\(.title)"')
while true; do
selected=$(echo "$vodcats" | fzf --prompt="🎞️ VOD Kategorie (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$selected" ]] && continue
echo
cat_id="${selected%%|*}"
vods=$(get_vod_list "$cat_id")
[[ -z "$vods" ]] && { echo "🚫 Keine Filme."; continue; }
# Filme alphabetisch sortieren
vods_sorted=$(echo "$vods" | sort -t$'\t' -k1)
while true; do
sel=$(echo "$vods_sorted" | fzf --delimiter=$'\t' --with-nth=1 --prompt="🎬 Film auswählen (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$sel" ]] && continue
cmd=$(echo "$sel" | cut -f2)
title=$(echo "$sel" | cut -f1 | sed 's/ /_/g' )
# Auswahl: Watch oder Download
action=$(echo -e "▶️ Watch\n⬇️ Download" | fzf --prompt="Wähle Aktion (ESC=zurück): ")
[[ $? -eq 130 ]] && continue
[[ -z "$action" ]] && continue
case "$action" in
"▶️ Watch")
play_vod "$cmd"
;;
"⬇️ Download")
download_vod "$cmd" "$title"
;;
esac
done
done
}
menu_series() {
sercats=$(get_series_categories | jq -r '.js[] | "\(.id)\t\(.title)"')
while true; do
selected=$(echo "$sercats" | fzf --delimiter=$'\t' --with-nth=2 --prompt="📚 Serien Kategorie (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$selected" ]] && continue
cat_id="${selected%%$'\t'*}"
series=$(get_series_list "$cat_id")
[[ -z "$series" ]] && { echo "🚫 Keine Serien."; continue; }
# Serien alphabetisch sortieren
series_sorted=$(echo "$series" | sort -t'|' -k1)
while true; do
sel_series=$(echo "$series_sorted" | fzf --prompt="📺 Serie auswählen (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$sel_series" ]] && continue
series_id="${sel_series#*|}"
episodes=$(get_episodes "$series_id")
[[ -z "$episodes" ]] && { echo "🚫 Keine Episoden."; continue; }
# Episoden alphabetisch sortieren
episodes_sorted=$(echo "$episodes" | sort -t$'\t' -k3,3 -k4,4n)
echo $episodes_sorted > bla
while true; do
sel_episode=$(echo "$episodes_sorted" | fzf --delimiter=$'\t' --with-nth=3 --prompt="🎬 Episode auswählen (ESC=zurück): ")
[[ $? -eq 130 ]] && break
[[ -z "$sel_episode" ]] && continue
season_cmd=$(echo "$sel_episode" | awk -F'\t' '{print $2}')
ep_num=$(echo "$sel_episode" | awk -F'\t' '{print $4}')
ep_title=$(echo "$sel_episode" | awk -F'\t' '{print $3}' | sed 's/ /_/g')
# Auswahl: Watch oder Download
action=$(echo -e "▶️ Watch\n⬇️ Download" | fzf --prompt="Wähle Aktion (ESC=zurück): ")
[[ $? -eq 130 ]] && continue
[[ -z "$action" ]] && continue
case "$action" in
"▶️ Watch")
play_series "$season_cmd" "$ep_num"
;;
"⬇️ Download")
download_series "$season_cmd" "$ep_num" "$ep_title"
;;
esac
done
done
done
}
# ==========================================================
# ⚙️ Start
# ==========================================================
clear
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📡 IPTV Portal Zugriff"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " MAC: $MAC"
echo " URL: $URL"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
get_token
while true; do
choice=$(echo -e "1|📺 LiveTV\n2|🎞️ VOD (Filme)\n3|📚 Serien\n0|❌ Beenden" | fzf --prompt="📂 Hauptmenü (ESC=Beenden): " --with-nth=2)
[[ -z "$choice" ]] && { echo "👋 Ende."; exit 0; }
case "${choice%%|*}" in
1) menu_live ;;
2) menu_vod ;;
3) menu_series ;;
0) echo "👋 Ende."; exit 0 ;;
esac
done
/home/stalkerdownloader.sh
Der Player funktioniert natürlich nur mit Desktop ;-)
Happy Viewing
CleVer
Zuletzt bearbeitet: