mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 11:35:29 +00:00
solve 409
This commit is contained in:
parent
128ab14993
commit
ae34aee2e8
@ -2,7 +2,6 @@
|
||||
|
||||
# Class import
|
||||
from Src.Util.Helper.headers import get_headers
|
||||
from Src.Util.Helper.util import convert_utf8_name
|
||||
from Src.Util.Helper.console import console
|
||||
from Src.Util.m3u8 import dw_m3u8
|
||||
|
||||
@ -80,9 +79,6 @@ def get_m3u8_audio(json_win_video, json_win_param, title_name, token_render):
|
||||
# [func \ main]
|
||||
def main_dw_film(id_film, title_name, domain):
|
||||
|
||||
lower_title_name = str(title_name).lower()
|
||||
title_name = convert_utf8_name(lower_title_name) # ERROR LATIN 1 IN REQ WITH ò à ù ...
|
||||
|
||||
embed_content = get_iframe(id_film, domain)
|
||||
json_win_video, json_win_param, render_quality = parse_content(embed_content)
|
||||
|
||||
@ -92,7 +88,7 @@ def main_dw_film(id_film, title_name, domain):
|
||||
m3u8_url = get_m3u8_url(json_win_video, json_win_param, render_quality)
|
||||
m3u8_key = get_m3u8_key(json_win_video, json_win_param, title_name, token_render)
|
||||
|
||||
mp4_name = lower_title_name.replace("+", " ").replace(",", "")
|
||||
mp4_name = title_name.replace("+", " ").replace(",", "")
|
||||
mp4_format = mp4_name + ".mp4"
|
||||
mp4_path = os.path.join("videos", mp4_format)
|
||||
|
||||
|
@ -9,25 +9,21 @@ import requests, sys
|
||||
|
||||
def domain_version():
|
||||
|
||||
req = requests.get("https://raw.githubusercontent.com/Ghost6446/Streaming_comunity_data/main/data.json")
|
||||
|
||||
if req.ok and requests.get(f"https://streamingcommunity.{req.json()['domain']}/").ok:
|
||||
return req.json()['domain'], req.json()['version']
|
||||
req_repo = requests.get("https://raw.githubusercontent.com/Ghost6446/Streaming_comunity_data/main/data.json", headers={'user-agent': get_headers()})
|
||||
|
||||
if req_repo.ok:
|
||||
return req_repo.json()['domain'], req_repo.json()['version']
|
||||
|
||||
else:
|
||||
console.log(f"[red]Error: {req.status_code}, new domain available")
|
||||
console.log(f"[red]Error: {req_repo.status_code}")
|
||||
sys.exit(0)
|
||||
|
||||
def search(title_search, domain):
|
||||
|
||||
title_search = str(title_search).replace(" ", "+")
|
||||
req = requests.get(
|
||||
url = f"https://streamingcommunity.{domain}/api/search?q={title_search}",
|
||||
headers = {"User-agent": get_headers()}
|
||||
)
|
||||
req = requests.get(f"https://streamingcommunity.{domain}/api/search?q={title_search}", headers={'user-agent': get_headers()})
|
||||
|
||||
if req.ok:
|
||||
return [{'name': title['name'], 'type': title['type'], 'id': title['id']} for title in req.json()['data']]
|
||||
return [{'name': title['name'], 'type': title['type'], 'id': title['id'], 'slug': title['slug']} for title in req.json()['data']]
|
||||
else:
|
||||
console.log(f"[red]Error: {req.status_code}")
|
||||
sys.exit(0)
|
@ -2,7 +2,6 @@
|
||||
|
||||
# Class import
|
||||
from Src.Util.Helper.headers import get_headers
|
||||
from Src.Util.Helper.util import convert_utf8_name
|
||||
from Src.Util.Helper.console import console, msg
|
||||
from Src.Util.m3u8 import dw_m3u8
|
||||
|
||||
@ -17,6 +16,7 @@ def get_token(id_tv, domain):
|
||||
return session.cookies['XSRF-TOKEN']
|
||||
|
||||
def get_info_tv(id_film, title_name, site_version, domain):
|
||||
|
||||
req = requests.get(f"https://streamingcommunity.{domain}/titles/{id_film}-{title_name}", headers={
|
||||
'X-Inertia': 'true',
|
||||
'X-Inertia-Version': site_version,
|
||||
@ -109,7 +109,7 @@ def get_m3u8_audio(json_win_video, json_win_param, tv_name, n_stagione, n_ep, ep
|
||||
|
||||
|
||||
# [func \ main]
|
||||
def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select, lower_tv_name):
|
||||
def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select):
|
||||
|
||||
console.print(f"[green]Download ep: [blue]{eps[index_ep_select]['n']} [green]=> [purple]{eps[index_ep_select]['name']}")
|
||||
embed_content = get_iframe(tv_id, eps[index_ep_select]['id'], domain, token)
|
||||
@ -121,7 +121,7 @@ def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_sel
|
||||
m3u8_url = get_m3u8_url(json_win_video, json_win_param, render_quality)
|
||||
m3u8_key = get_m3u8_key_ep(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, eps[index_ep_select]['name'], token_render)
|
||||
|
||||
mp4_name = f"{lower_tv_name.replace('+', '_')}_S{str(season_select)}E{str(index_ep_select+1)}"
|
||||
mp4_name = f"{tv_name.replace('+', '_')}_S{str(season_select)}E{str(index_ep_select+1)}"
|
||||
mp4_format = mp4_name + ".mp4"
|
||||
mp4_path = os.path.join("videos", mp4_format)
|
||||
|
||||
@ -137,9 +137,6 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
|
||||
token = get_token(tv_id, domain)
|
||||
|
||||
lower_tv_name = str(tv_name).lower()
|
||||
tv_name = convert_utf8_name(lower_tv_name) # ERROR LATIN 1 IN REQ WITH ò à ù ...
|
||||
|
||||
num_season_find = get_info_tv(tv_id, tv_name, version, domain)
|
||||
console.print(f"[blue]Season find: [red]{num_season_find}")
|
||||
season_select = int(msg.ask("\n[green]Insert season number: "))
|
||||
@ -154,13 +151,13 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
if index_ep_select != "*":
|
||||
if 1 <= int(index_ep_select) <= len(eps):
|
||||
index_ep_select = int(index_ep_select) - 1
|
||||
dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select, lower_tv_name)
|
||||
dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select)
|
||||
else:
|
||||
console.print("[red]Wrong index for ep")
|
||||
|
||||
else:
|
||||
for ep in eps:
|
||||
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, season_select, lower_tv_name)
|
||||
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, season_select)
|
||||
print("\n")
|
||||
|
||||
else:
|
||||
|
@ -1,5 +1,5 @@
|
||||
__title__ = 'Streaming_community'
|
||||
__version__ = 'v0.8.1'
|
||||
__version__ = 'v0.8.2'
|
||||
__author__ = 'Ghost6446'
|
||||
__description__ = 'A command-line program to download film'
|
||||
__license__ = 'MIT License'
|
||||
|
@ -1,10 +1,7 @@
|
||||
# 4.01.2023
|
||||
|
||||
# Import
|
||||
import ffmpeg, subprocess, re
|
||||
|
||||
def convert_utf8_name(name):
|
||||
return str(name).encode('utf-8').decode('latin-1')
|
||||
import ffmpeg, subprocess
|
||||
|
||||
def there_is_audio(ts_file_path):
|
||||
probe = ffmpeg.probe(ts_file_path)
|
||||
|
6
run.py
6
run.py
@ -11,11 +11,9 @@ from Src.Upload.update import main_update
|
||||
# General import
|
||||
import sys
|
||||
|
||||
|
||||
# Variable
|
||||
domain, site_version = Page.domain_version()
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
msg_start()
|
||||
@ -34,11 +32,11 @@ def main():
|
||||
if 0 <= index_select <= len(db_title)-1:
|
||||
if db_title[index_select]['type'] == "movie":
|
||||
console.print(f"[green]\nMovie select: {db_title[index_select]['name']}")
|
||||
download_film(db_title[index_select]['id'], db_title[index_select]['name'].replace(" ", "+"), domain)
|
||||
download_film(db_title[index_select]['id'], db_title[index_select]['slug'], domain)
|
||||
|
||||
else:
|
||||
console.print(f"[green]\nTv select: {db_title[index_select]['name']}")
|
||||
download_tv(db_title[index_select]['id'], db_title[index_select]['name'].replace(" ", "+"), site_version, domain)
|
||||
download_tv(db_title[index_select]['id'], db_title[index_select]['slug'], site_version, domain)
|
||||
|
||||
else:
|
||||
console.print("[red]Wrong index for selection")
|
||||
|
Loading…
x
Reference in New Issue
Block a user