mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
style: correct some user messages and typos
This commit is contained in:
parent
0094458c3d
commit
1ead333e37
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
14
.idea/StreamingCommunity_api.iml
generated
Normal file
14
.idea/StreamingCommunity_api.iml
generated
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/StreamingCommunity_api.iml" filepath="$PROJECT_DIR$/.idea/StreamingCommunity_api.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -22,7 +22,7 @@ def get_iframe(id_title, domain):
|
||||
try:
|
||||
return BeautifulSoup(req_embed, "lxml").find("body").find("script").text
|
||||
except:
|
||||
console.log("[red]Cant play this video, (video not available)")
|
||||
console.log("[red]Couldn't play this video file (video not available)")
|
||||
sys.exit(0)
|
||||
|
||||
else:
|
||||
@ -89,7 +89,7 @@ def main_dw_film(id_film, title_name, domain):
|
||||
json_win_video, json_win_param, render_quality = parse_content(embed_content)
|
||||
|
||||
token_render = f"token{render_quality}"
|
||||
console.print(f"[blue]Quality select => [red]{render_quality}")
|
||||
console.print(f"[blue]Selected quality => [red]{render_quality}")
|
||||
|
||||
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)
|
||||
@ -101,6 +101,6 @@ def main_dw_film(id_film, title_name, domain):
|
||||
m3u8_url_audio = get_m3u8_audio(json_win_video, json_win_param, title_name, token_render)
|
||||
|
||||
if m3u8_url_audio != None:
|
||||
console.print("[blue]Use m3u8 audio => [red]True")
|
||||
console.print("[blue]Using m3u8 audio => [red]True")
|
||||
|
||||
download_m3u8(m3u8_index=m3u8_url, m3u8_audio=m3u8_url_audio, m3u8_subtitle=m3u8_url, key=m3u8_key, output_filename=mp4_path)
|
||||
|
@ -26,7 +26,7 @@ def domain_version():
|
||||
return domain, version
|
||||
|
||||
except Exception as e:
|
||||
console.log("[red]Cant get version, problem with domain. Try again.")
|
||||
console.log("[red]Couldn't get the version, there's a problem with the domain. Try again.")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
@ -125,12 +125,12 @@ def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_sel
|
||||
|
||||
enccoded_name = urllib.parse.quote(eps[index_ep_select]['name'])
|
||||
|
||||
console.print(f"[green]Download ep: [blue]{eps[index_ep_select]['n']} [green]=> [purple]{eps[index_ep_select]['name']}")
|
||||
console.print(f"[green]Downloading episode: [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)
|
||||
json_win_video, json_win_param, render_quality = parse_content(embed_content)
|
||||
|
||||
token_render = f"token{render_quality}"
|
||||
console.print(f"[blue]Quality select => [red]{render_quality}")
|
||||
console.print(f"[blue]Selected quality => [red]{render_quality}")
|
||||
|
||||
m3u8_playlist = get_playlist(json_win_video, json_win_param, render_quality)
|
||||
m3u8_url = get_m3u8_url(json_win_video, json_win_param, render_quality)
|
||||
@ -143,7 +143,7 @@ def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_sel
|
||||
m3u8_url_audio = get_m3u8_playlist(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, enccoded_name, token_render)
|
||||
|
||||
if m3u8_url_audio != None:
|
||||
console.print("[blue]Use m3u8 audio => [red]True")
|
||||
console.print("[blue]Using m3u8 audio => [red]True")
|
||||
|
||||
download_m3u8(m3u8_index=m3u8_url, m3u8_audio=m3u8_url_audio, m3u8_subtitle=m3u8_playlist, key=m3u8_key, output_filename=mp4_path)
|
||||
|
||||
@ -152,9 +152,9 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
token = get_token(tv_id, domain)
|
||||
|
||||
num_season_find = get_info_tv(tv_id, tv_name, version, domain)
|
||||
console.print("\n[green]Insert season [red]number [yellow]or [red](*) [green]to download all seasons [yellow]or [red][1-2] [green]for a range of season")
|
||||
console.print(f"\n[blue]Season find: [red]{num_season_find}")
|
||||
season_select = str(msg.ask("\n[green]Insert season number: "))
|
||||
console.print("\n[green]Insert season [red]number [yellow]or [red](*) [green]to download all seasons [yellow]or [red][1-2] [green]for a range of seasons")
|
||||
console.print(f"\n[blue]Season(s) found: [red]{num_season_find}")
|
||||
season_select = str(msg.ask("\n[green]Insert season(s) number: "))
|
||||
if "[" in season_select:
|
||||
start, end = map(int, season_select[1:-1].split('-'))
|
||||
result = list(range(start, end + 1))
|
||||
@ -169,8 +169,8 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
eps = get_info_season(tv_id, tv_name, domain, version, token, season_select)
|
||||
|
||||
for ep in eps:
|
||||
console.print(f"[green]Ep: [blue]{ep['n']} [green]=> [purple]{ep['name']}")
|
||||
index_ep_select = str(msg.ask("\n[green]Insert ep [red]number [yellow]or [red](*) [green]to download all ep [yellow]or [red][1-2] [green]for a range of ep: "))
|
||||
console.print(f"[green]Episode: [blue]{ep['n']} [green]=> [purple]{ep['name']}")
|
||||
index_ep_select = str(msg.ask("\n[green]Insert episode [red]number [yellow]or [red](*) [green]to download all episodes [yellow]or [red][1-2] [green]for a range of episodes: "))
|
||||
|
||||
# Download range []
|
||||
if "[" in index_ep_select:
|
||||
@ -187,7 +187,7 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
index_ep_select = int(index_ep_select) - 1
|
||||
dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select)
|
||||
else:
|
||||
console.print("[red]Wrong index for ep")
|
||||
console.print("[red]Wrong INDEX for the selected Episode")
|
||||
|
||||
# Download all
|
||||
else:
|
||||
@ -196,7 +196,7 @@ def main_dw_tv(tv_id, tv_name, version, domain):
|
||||
print("\n")
|
||||
|
||||
else:
|
||||
console.print("[red]Wrong index for season")
|
||||
console.print("[red]Wrong INDEX for the selected Season")
|
||||
else:
|
||||
for n_season in range(1, num_season_find+1):
|
||||
eps = get_info_season(tv_id, tv_name, domain, version, token, n_season)
|
||||
|
@ -55,7 +55,7 @@ def check_ffmpeg():
|
||||
console.print("[cyan]FFmpeg is not in the PATH. Downloading and adding to the PATH...[/cyan]")
|
||||
|
||||
if not isAdmin():
|
||||
console.log("[red]You need to be admin to proceed!")
|
||||
console.log("[red]You need admin privileges to proceed!")
|
||||
sys.exit(0)
|
||||
|
||||
download_ffmpeg()
|
||||
|
@ -20,7 +20,7 @@ warnings.filterwarnings("ignore", category=UserWarning, module="cryptography")
|
||||
|
||||
# Variable
|
||||
MAX_WORKER = 20
|
||||
DONWLOAD_SUB = True
|
||||
DOWNLOAD_SUB = True
|
||||
DOWNLOAD_DEFAULT_LANGUAGE = False
|
||||
failed_segments = []
|
||||
|
||||
@ -107,7 +107,7 @@ class M3U8_Parser:
|
||||
if self.video_playlist:
|
||||
return self.video_playlist[0].get('uri')
|
||||
else:
|
||||
print("No video playlist find")
|
||||
print("No video playlist found")
|
||||
return None
|
||||
|
||||
def download_subtitle(self):
|
||||
@ -123,7 +123,7 @@ class M3U8_Parser:
|
||||
continue
|
||||
|
||||
os.makedirs(path, exist_ok=True)
|
||||
console.log(f"[green]Download subtitle: [red]{name_language}")
|
||||
console.log(f"[green]Downloading subtitle: [red]{name_language}")
|
||||
req_sub_content = requests.get(sub_info.get("uri"))
|
||||
|
||||
sub_parse = M3U8_Parser()
|
||||
@ -133,13 +133,13 @@ class M3U8_Parser:
|
||||
open(os.path.join(path, name_language + ".vtt"), "wb").write(requests.get(url_subititle).content)
|
||||
|
||||
else:
|
||||
console.log("[red]No subtitle find")
|
||||
console.log("[red]No subtitle found")
|
||||
|
||||
def get_track_audio(self, language_name): # Ex. English
|
||||
"""Return url of audio eng audio playlist if present"""
|
||||
|
||||
if self.audio_ts:
|
||||
console.log(f"[cyan]Find {len(self.audio_ts)}, playlist with audio")
|
||||
console.log(f"[cyan]Found {len(self.audio_ts)}, playlist with audio")
|
||||
|
||||
if language_name != None:
|
||||
for obj_audio in self.audio_ts:
|
||||
@ -149,7 +149,7 @@ class M3U8_Parser:
|
||||
return None
|
||||
|
||||
else:
|
||||
console.log("[red]Cant find playlist with audio")
|
||||
console.log("[red]Couldn't find any playlist with audio")
|
||||
|
||||
class M3U8_Segments:
|
||||
def __init__(self, url, key=None):
|
||||
@ -187,7 +187,7 @@ class M3U8_Segments:
|
||||
#console.log(f"[red]Ts segments find [white]=> [yellow]{len(self.segments)}")
|
||||
|
||||
if len(self.segments) == 0:
|
||||
console.log("[red]Cant find segments to donwload, retry")
|
||||
console.log("[red]Couldn't find any segments to download, retry")
|
||||
sys.exit(0)
|
||||
|
||||
else:
|
||||
@ -316,7 +316,7 @@ class M3U8_Segments:
|
||||
ts_files.sort(key=extract_number)
|
||||
|
||||
if len(ts_files) == 0:
|
||||
console.log("[red]Cant find segments to join, retry")
|
||||
console.log("[red]Couldn't find any segments to join, retry")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ class M3U8_Segments:
|
||||
relative_path = os.path.relpath(os.path.join(self.temp_folder, ts_file), current_dir)
|
||||
f.write(f"file '{relative_path}'\n")
|
||||
|
||||
console.log("[cyan]Start join all file")
|
||||
console.log("[cyan]Joining all files...")
|
||||
try:
|
||||
ffmpeg.input(file_list_path, format='concat', safe=0).output(output_filename, c='copy', loglevel='error').run()
|
||||
except ffmpeg.Error as e:
|
||||
@ -411,7 +411,7 @@ def download_subtitle(url, name_language):
|
||||
path = os.path.join("videos", "subtitle")
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
console.log(f"[green]Download subtitle: [red]{name_language}")
|
||||
console.log(f"[green]Downloading subtitle: [red]{name_language}")
|
||||
open(os.path.join(path, name_language + ".vtt"), "wb").write(requests.get(url).content)
|
||||
|
||||
def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_subtitle=None, key=None, output_filename=os.path.join("videos", "output.mp4"), log=False):
|
||||
@ -420,7 +420,7 @@ def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_s
|
||||
key = bytes.fromhex(key) if key is not None else key
|
||||
|
||||
if m3u8_playlist != None:
|
||||
console.log(f"[green]Dowload m3u8 from playlist")
|
||||
console.log(f"[green]Downloading m3u8 from playlist")
|
||||
|
||||
# Parse m3u8 playlist
|
||||
parse_class_m3u8 = M3U8_Parser()
|
||||
@ -432,24 +432,24 @@ def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_s
|
||||
parse_class_m3u8.parse_data(m3u8_playlist)
|
||||
|
||||
|
||||
# Get italian language in present as defualt
|
||||
# Get italian language if present as default
|
||||
if DOWNLOAD_DEFAULT_LANGUAGE:
|
||||
m3u8_audio = parse_class_m3u8.get_track_audio("Italian")
|
||||
console.log(f"[green]Select language => [purple]{m3u8_audio}")
|
||||
console.log(f"[green]Selected language => [purple]{m3u8_audio}")
|
||||
|
||||
|
||||
# Get best quality
|
||||
if m3u8_index == None:
|
||||
m3u8_index = parse_class_m3u8.get_best_quality()
|
||||
if "https" in m3u8_index:
|
||||
if log: console.log(f"[green]Select m3u8 index => [purple]{m3u8_index}")
|
||||
if log: console.log(f"[green]Selected m3u8 index => [purple]{m3u8_index}")
|
||||
else:
|
||||
console.log("[red]Cant find a valid m3u8 index")
|
||||
console.log("[red]Couldn't find a valid m3u8 index")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# Download subtitle if present ( normaly in m3u8 playlist )
|
||||
if DONWLOAD_SUB:
|
||||
# Download subtitle if present ( normally in m3u8 playlist )
|
||||
if DOWNLOAD_SUB:
|
||||
parse_class_m3u8.download_subtitle()
|
||||
|
||||
if m3u8_subtitle != None:
|
||||
@ -463,7 +463,7 @@ def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_s
|
||||
parse_class_m3u8_sub.parse_data(m3u8_subtitle)
|
||||
|
||||
# Download subtitle if present ( normaly in m3u8 playlist )
|
||||
if DONWLOAD_SUB:
|
||||
if DOWNLOAD_SUB:
|
||||
parse_class_m3u8_sub.download_subtitle()
|
||||
|
||||
|
||||
@ -473,5 +473,5 @@ def download_m3u8(m3u8_playlist=None, m3u8_index = None, m3u8_audio=None, m3u8_s
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
if log:
|
||||
console.log(f"[green]Dowload m3u8 from index [white]=> [purple]{m3u8_index}")
|
||||
console.log(f"[green]Download m3u8 from index [white]=> [purple]{m3u8_index}")
|
||||
M3U8_Downloader(m3u8_index, m3u8_audio, key=key, output_filename=output_filename).start()
|
@ -34,11 +34,11 @@ def main_update():
|
||||
|
||||
if get_install_version() != last_version:
|
||||
console.print(f"[red]=> A new version is available: [green]{json['zipball_url']}")
|
||||
console.print(f"[red]=> Versione: [yellow]{json['name']}")
|
||||
console.print(f"[red]=> New Version: [yellow]{json['name']}")
|
||||
|
||||
else:
|
||||
console.print(f"[red]=> Everything up to date")
|
||||
console.print(f"[red]=> Last version: [yellow]{json['name']}")
|
||||
console.print(f"[red]=> Everything is up to date")
|
||||
console.print(f"[red]=> Latest version: [yellow]{json['name']}")
|
||||
|
||||
|
||||
print("\n")
|
||||
|
28
run.py
28
run.py
@ -36,30 +36,30 @@ def main():
|
||||
initialize()
|
||||
domain, site_version = Page.domain_version()
|
||||
|
||||
film_search = msg.ask("\n[blue]Insert word to search in all site: ").strip()
|
||||
film_search = msg.ask("\n[blue]Search for any movie or tv series title: ").strip()
|
||||
db_title = Page.search(film_search, domain)
|
||||
Page.display_search_results(db_title)
|
||||
|
||||
if len(db_title) != 0:
|
||||
console.print(f"\n[blue]Total result: {len(db_title)}")
|
||||
console.print(
|
||||
"\n[green]Insert index [red]number [yellow]or [red][1-2] [green]for a range of movies/tv [yellow]or [red][1,3,5] [green]to select discontinued movie/tv"
|
||||
"\n[green]Insert INDEX [red]number [yellow]or [red][1-2] [green]for a range of movies/tv series [yellow]or [red][1,3,5] [green]to select discontinued movie/tv series"
|
||||
)
|
||||
console.print("\n[red]In case of tv show you will have to choose season and episode to download")
|
||||
index_select = str(msg.ask("\n[blue]Index to download: "))
|
||||
console.print("\n[red]In case of a TV Series you will choose seasons and episodes to download")
|
||||
index_select = str(msg.ask("\n[blue]Select INDEX to download: "))
|
||||
if index_select.isnumeric():
|
||||
index_select = int(index_select)
|
||||
if 0 <= index_select <= len(db_title) - 1:
|
||||
selected_title = db_title[index_select]
|
||||
|
||||
if selected_title['type'] == "movie":
|
||||
console.print(f"[green]\nMovie select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected Movie: {selected_title['name']}")
|
||||
download_film(selected_title['id'], selected_title['slug'], domain)
|
||||
else:
|
||||
console.print(f"[green]\nTv select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected TV Series: {selected_title['name']}")
|
||||
download_tv(selected_title['id'], selected_title['slug'], site_version, domain)
|
||||
else:
|
||||
console.print("[red]Wrong index for selection")
|
||||
console.print("[red]Wrong INDEX for selection")
|
||||
elif "[" in index_select:
|
||||
if "-" in index_select:
|
||||
start, end = map(int, index_select[1:-1].split('-'))
|
||||
@ -67,27 +67,27 @@ def main():
|
||||
for n in result:
|
||||
selected_title = db_title[n]
|
||||
if selected_title['type'] == "movie":
|
||||
console.print(f"[green]\nMovie select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected Movie: {selected_title['name']}")
|
||||
download_film(selected_title['id'], selected_title['slug'], domain)
|
||||
else:
|
||||
console.print(f"[green]\nTv select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected TV Series: {selected_title['name']}")
|
||||
download_tv(selected_title['id'], selected_title['slug'], site_version, domain)
|
||||
elif "," in index_select:
|
||||
result = list(map(int, index_select[1:-1].split(',')))
|
||||
for n in result:
|
||||
selected_title = db_title[n]
|
||||
if selected_title['type'] == "movie":
|
||||
console.print(f"[green]\nMovie select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected Movie: {selected_title['name']}")
|
||||
download_film(selected_title['id'], selected_title['slug'], domain)
|
||||
else:
|
||||
console.print(f"[green]\nTv select: {selected_title['name']}")
|
||||
console.print(f"[green]\nSelected TV Series: {selected_title['name']}")
|
||||
download_tv(selected_title['id'], selected_title['slug'], site_version, domain)
|
||||
else:
|
||||
console.print("[red]Wrong index for selection")
|
||||
console.print("[red]Wrong INDEX for selection")
|
||||
else:
|
||||
console.print("[red]Cant find a single element")
|
||||
console.print("[red]Couldn't find any entries for the selected title")
|
||||
|
||||
console.print("[red]Done")
|
||||
console.print("[red]Done!")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -66,7 +66,7 @@ def download_and_extract_latest_commit(author, repo_name):
|
||||
temp_path = os.path.join(os.path.dirname(os.getcwd()), 'temp_extracted')
|
||||
with ZipFile(BytesIO(response.content)) as zip_ref:
|
||||
zip_ref.extractall(temp_path)
|
||||
console.log("[green]Extract file ...")
|
||||
console.log("[green]Extracting file ...")
|
||||
|
||||
|
||||
# Move files from the temporary folder to the current folder
|
||||
|
Loading…
x
Reference in New Issue
Block a user