From ba13f64d7f4d7d97a8c30c3f48a416f2b5ca5e50 Mon Sep 17 00:00:00 2001 From: Ghost <62809003+Ghost6446@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:08:39 +0100 Subject: [PATCH] fix error key and folder --- Src/Api/film.py | 10 +++++----- Src/Api/tv.py | 10 +++++----- Src/Lib/FFmpeg/my_m3u8.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Src/Api/film.py b/Src/Api/film.py index 376146d..ec7dfde 100644 --- a/Src/Api/film.py +++ b/Src/Api/film.py @@ -6,7 +6,7 @@ from Src.Util.console import console from Src.Lib.FFmpeg.my_m3u8 import download_m3u8 # General import -import requests, os, re, json, sys +import requests, os, re, json, sys, binascii from bs4 import BeautifulSoup # [func] @@ -57,14 +57,14 @@ def get_m3u8_url(json_win_video, json_win_param, render_quality): return f"https://vixcloud.co/playlist/{json_win_video['id']}?type=video&rendition={render_quality}&token={json_win_param[token_render]}&expires={json_win_param['expires']}" def get_m3u8_key(json_win_video, json_win_param, title_name, token_render): - req = requests.get('https://vixcloud.co/storage/enc.key', headers={ + response = requests.get('https://vixcloud.co/storage/enc.key', headers={ 'referer': f'https://vixcloud.co/embed/{json_win_video["id"]}?token={json_win_param[token_render]}&title={title_name}&referer=1&expires={json_win_param["expires"]}', }) - if req.ok: - return "".join(["{:02x}".format(c) for c in req.content]) + if response.ok: + return binascii.hexlify(response.content).decode('utf-8') else: - console.log(f"[red]Error: {req.status_code}") + console.log(f"[red]Error: {response.status_code}") sys.exit(0) def get_m3u8_audio(json_win_video, json_win_param, title_name, token_render): diff --git a/Src/Api/tv.py b/Src/Api/tv.py index 59449f8..9ac7220 100644 --- a/Src/Api/tv.py +++ b/Src/Api/tv.py @@ -6,7 +6,7 @@ from Src.Util.console import console, msg from Src.Lib.FFmpeg.my_m3u8 import download_m3u8 # General import -import requests, os, re, json, sys +import requests, os, re, json, sys, binascii from bs4 import BeautifulSoup @@ -94,14 +94,14 @@ def get_m3u8_url(json_win_video, json_win_param, render_quality): return f"https://vixcloud.co/playlist/{json_win_video['id']}?type=video&rendition={render_quality}&token={json_win_param[token_render]}&expires={json_win_param['expires']}" def get_m3u8_key_ep(json_win_video, json_win_param, tv_name, n_stagione, n_ep, ep_title, token_render): - req = requests.get('https://vixcloud.co/storage/enc.key', headers={ + response = requests.get('https://vixcloud.co/storage/enc.key', headers={ 'referer': f'https://vixcloud.co/embed/{json_win_video["id"]}?token={json_win_param[token_render]}&title={tv_name}&referer=1&expires={json_win_param["expires"]}&description=S{n_stagione}%3AE{n_ep}+{ep_title}&nextEpisode=1', }) - if req.ok: - return "".join(["{:02x}".format(c) for c in req.content]) + if response.ok: + return binascii.hexlify(response.content).decode('utf-8') else: - console.log(f"[red]Error: {req.status_code}") + console.log(f"[red]Error: {response.status_code}") sys.exit(0) def get_m3u8_playlist(json_win_video, json_win_param, tv_name, n_stagione, n_ep, ep_title, token_render): diff --git a/Src/Lib/FFmpeg/my_m3u8.py b/Src/Lib/FFmpeg/my_m3u8.py index 2cc81b8..e810d9a 100644 --- a/Src/Lib/FFmpeg/my_m3u8.py +++ b/Src/Lib/FFmpeg/my_m3u8.py @@ -459,7 +459,7 @@ def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_s # Download m3u8 index, with segments # os.makedirs("videos", exist_ok=True) - path = output_filename.split("\\") + path = os.path.expanduser(output_filename) os.makedirs("\\".join(path[:-1]), exist_ok=True) if log: console.log(f"[green]Dowload m3u8 from index [white]=> [purple]{m3u8_index}") M3U8_Downloader(m3u8_index, m3u8_audio, key=key, output_filename=output_filename).start() \ No newline at end of file