StreamingCommunity 1.9.8__py3-none-any.whl → 1.9.90__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of StreamingCommunity might be problematic. Click here for more details.
- StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py +143 -0
- StreamingCommunity/Api/Player/Helper/Vixcloud/util.py +145 -0
- StreamingCommunity/Api/Player/ddl.py +89 -0
- StreamingCommunity/Api/Player/maxstream.py +151 -0
- StreamingCommunity/Api/Player/supervideo.py +194 -0
- StreamingCommunity/Api/Player/vixcloud.py +273 -0
- StreamingCommunity/Api/Site/1337xx/__init__.py +51 -0
- StreamingCommunity/Api/Site/1337xx/costant.py +15 -0
- StreamingCommunity/Api/Site/1337xx/site.py +86 -0
- StreamingCommunity/Api/Site/1337xx/title.py +66 -0
- StreamingCommunity/Api/Site/altadefinizione/__init__.py +51 -0
- StreamingCommunity/Api/Site/altadefinizione/costant.py +15 -0
- StreamingCommunity/Api/Site/altadefinizione/film.py +74 -0
- StreamingCommunity/Api/Site/altadefinizione/site.py +89 -0
- StreamingCommunity/Api/Site/animeunity/__init__.py +51 -0
- StreamingCommunity/Api/Site/animeunity/costant.py +15 -0
- StreamingCommunity/Api/Site/animeunity/film_serie.py +135 -0
- StreamingCommunity/Api/Site/animeunity/site.py +167 -0
- StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +97 -0
- StreamingCommunity/Api/Site/cb01new/__init__.py +52 -0
- StreamingCommunity/Api/Site/cb01new/costant.py +15 -0
- StreamingCommunity/Api/Site/cb01new/film.py +73 -0
- StreamingCommunity/Api/Site/cb01new/site.py +76 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +58 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +16 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +146 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +95 -0
- StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +85 -0
- StreamingCommunity/Api/Site/guardaserie/__init__.py +53 -0
- StreamingCommunity/Api/Site/guardaserie/costant.py +15 -0
- StreamingCommunity/Api/Site/guardaserie/series.py +199 -0
- StreamingCommunity/Api/Site/guardaserie/site.py +86 -0
- StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +110 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +52 -0
- StreamingCommunity/Api/Site/ilcorsaronero/costant.py +15 -0
- StreamingCommunity/Api/Site/ilcorsaronero/site.py +63 -0
- StreamingCommunity/Api/Site/ilcorsaronero/title.py +46 -0
- StreamingCommunity/Api/Site/ilcorsaronero/util/ilCorsarScraper.py +141 -0
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +49 -0
- StreamingCommunity/Api/Site/mostraguarda/costant.py +15 -0
- StreamingCommunity/Api/Site/mostraguarda/film.py +99 -0
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +56 -0
- StreamingCommunity/Api/Site/streamingcommunity/costant.py +15 -0
- StreamingCommunity/Api/Site/streamingcommunity/film.py +75 -0
- StreamingCommunity/Api/Site/streamingcommunity/series.py +206 -0
- StreamingCommunity/Api/Site/streamingcommunity/site.py +137 -0
- StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +123 -0
- StreamingCommunity/Api/Template/Class/SearchType.py +101 -0
- StreamingCommunity/Api/Template/Util/__init__.py +5 -0
- StreamingCommunity/Api/Template/Util/get_domain.py +173 -0
- StreamingCommunity/Api/Template/Util/manage_ep.py +179 -0
- StreamingCommunity/Api/Template/Util/recall_search.py +37 -0
- StreamingCommunity/Api/Template/__init__.py +3 -0
- StreamingCommunity/Api/Template/site.py +87 -0
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +946 -0
- StreamingCommunity/Lib/Downloader/HLS/proxyes.py +110 -0
- StreamingCommunity/Lib/Downloader/HLS/segments.py +561 -0
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +155 -0
- StreamingCommunity/Lib/Downloader/TOR/downloader.py +296 -0
- StreamingCommunity/Lib/Downloader/__init__.py +5 -0
- StreamingCommunity/Lib/FFmpeg/__init__.py +4 -0
- StreamingCommunity/Lib/FFmpeg/capture.py +170 -0
- StreamingCommunity/Lib/FFmpeg/command.py +296 -0
- StreamingCommunity/Lib/FFmpeg/util.py +249 -0
- StreamingCommunity/Lib/M3U8/__init__.py +6 -0
- StreamingCommunity/Lib/M3U8/decryptor.py +164 -0
- StreamingCommunity/Lib/M3U8/estimator.py +176 -0
- StreamingCommunity/Lib/M3U8/parser.py +666 -0
- StreamingCommunity/Lib/M3U8/url_fixer.py +52 -0
- StreamingCommunity/Lib/TMBD/__init__.py +2 -0
- StreamingCommunity/Lib/TMBD/obj_tmbd.py +39 -0
- StreamingCommunity/Lib/TMBD/tmdb.py +346 -0
- StreamingCommunity/Upload/update.py +68 -0
- StreamingCommunity/Upload/version.py +5 -0
- StreamingCommunity/Util/_jsonConfig.py +204 -0
- StreamingCommunity/Util/call_stack.py +42 -0
- StreamingCommunity/Util/color.py +20 -0
- StreamingCommunity/Util/console.py +12 -0
- StreamingCommunity/Util/ffmpeg_installer.py +311 -0
- StreamingCommunity/Util/headers.py +147 -0
- StreamingCommunity/Util/logger.py +53 -0
- StreamingCommunity/Util/message.py +64 -0
- StreamingCommunity/Util/os.py +554 -0
- StreamingCommunity/Util/table.py +229 -0
- StreamingCommunity/__init__.py +0 -0
- StreamingCommunity/run.py +2 -2
- {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/METADATA +7 -10
- StreamingCommunity-1.9.90.dist-info/RECORD +92 -0
- {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/WHEEL +1 -1
- {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/entry_points.txt +0 -1
- StreamingCommunity-1.9.8.dist-info/RECORD +0 -7
- {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/LICENSE +0 -0
- {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 12.14.24
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import asyncio
|
|
5
|
+
from typing import List, Dict, Optional
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# External libraries
|
|
9
|
+
import httpx
|
|
10
|
+
from bs4 import BeautifulSoup
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Internal utilities
|
|
14
|
+
from StreamingCommunity.Util._jsonConfig import config_manager
|
|
15
|
+
from StreamingCommunity.Util.headers import get_headers
|
|
16
|
+
from StreamingCommunity.Util.console import console
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Variable
|
|
20
|
+
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class IlCorsaroNeroScraper:
|
|
24
|
+
def __init__(self, base_url: str, max_page: int = 1):
|
|
25
|
+
self.base_url = base_url
|
|
26
|
+
self.max_page = max_page
|
|
27
|
+
self.headers = {
|
|
28
|
+
'User-Agent': get_headers(),
|
|
29
|
+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
|
30
|
+
'Accept-Language': 'en-US,en;q=0.5',
|
|
31
|
+
'Connection': 'keep-alive',
|
|
32
|
+
'Upgrade-Insecure-Requests': '1'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async def fetch_url(self, url: str) -> Optional[str]:
|
|
36
|
+
"""
|
|
37
|
+
Fetch the HTML content of a given URL.
|
|
38
|
+
"""
|
|
39
|
+
try:
|
|
40
|
+
console.print(f"[cyan]Fetching url[white]: [red]{url}")
|
|
41
|
+
async with httpx.AsyncClient(headers=self.headers, follow_redirects=True, timeout=max_timeout) as client:
|
|
42
|
+
response = await client.get(url)
|
|
43
|
+
|
|
44
|
+
# If the request was successful, return the HTML content
|
|
45
|
+
response.raise_for_status()
|
|
46
|
+
return response.text
|
|
47
|
+
|
|
48
|
+
except Exception as e:
|
|
49
|
+
logging.error(f"Error fetching {url}: {e}")
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
def parse_torrents(self, html: str) -> List[Dict[str, str]]:
|
|
53
|
+
"""
|
|
54
|
+
Parse the HTML content and extract torrent details.
|
|
55
|
+
"""
|
|
56
|
+
torrents = []
|
|
57
|
+
soup = BeautifulSoup(html, "html.parser")
|
|
58
|
+
table = soup.find("tbody")
|
|
59
|
+
|
|
60
|
+
for row in table.find_all("tr"):
|
|
61
|
+
try:
|
|
62
|
+
columns = row.find_all("td")
|
|
63
|
+
|
|
64
|
+
torrents.append({
|
|
65
|
+
'type': columns[0].get_text(strip=True),
|
|
66
|
+
'name': row.find("th").find("a").get_text(strip=True),
|
|
67
|
+
'seed': columns[1].get_text(strip=True),
|
|
68
|
+
'leech': columns[2].get_text(strip=True),
|
|
69
|
+
'size': columns[3].get_text(strip=True),
|
|
70
|
+
'date': columns[4].get_text(strip=True),
|
|
71
|
+
'url': "https://ilcorsaronero.link" + row.find("th").find("a").get("href")
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
except Exception as e:
|
|
75
|
+
logging.error(f"Error parsing row: {e}")
|
|
76
|
+
continue
|
|
77
|
+
|
|
78
|
+
return torrents
|
|
79
|
+
|
|
80
|
+
async def fetch_real_url(self, url: str) -> Optional[str]:
|
|
81
|
+
"""
|
|
82
|
+
Fetch the real torrent URL from the detailed page.
|
|
83
|
+
"""
|
|
84
|
+
response_html = await self.fetch_url(url)
|
|
85
|
+
if not response_html:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
soup = BeautifulSoup(response_html, "html.parser")
|
|
89
|
+
links = soup.find_all("a")
|
|
90
|
+
|
|
91
|
+
# Find and return the magnet link
|
|
92
|
+
for link in links:
|
|
93
|
+
if "magnet" in str(link):
|
|
94
|
+
return link.get("href")
|
|
95
|
+
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
async def search(self, query: str) -> List[Dict[str, str]]:
|
|
99
|
+
"""
|
|
100
|
+
Search for torrents based on the query string.
|
|
101
|
+
"""
|
|
102
|
+
all_torrents = []
|
|
103
|
+
|
|
104
|
+
# Loop through each page
|
|
105
|
+
for page in range(self.max_page):
|
|
106
|
+
url = f'{self.base_url}search?q={query}&page={page}'
|
|
107
|
+
|
|
108
|
+
html = await self.fetch_url(url)
|
|
109
|
+
if not html:
|
|
110
|
+
console.print(f"[bold red]No HTML content for page {page}[/bold red]")
|
|
111
|
+
break
|
|
112
|
+
|
|
113
|
+
torrents = self.parse_torrents(html)
|
|
114
|
+
if not torrents:
|
|
115
|
+
console.print(f"[bold red]No torrents found on page {page}[/bold red]")
|
|
116
|
+
break
|
|
117
|
+
|
|
118
|
+
# Use asyncio.gather to fetch all real URLs concurrently
|
|
119
|
+
tasks = [self.fetch_real_url(result['url']) for result in torrents]
|
|
120
|
+
real_urls = await asyncio.gather(*tasks)
|
|
121
|
+
|
|
122
|
+
# Attach real URLs to the torrent data
|
|
123
|
+
for i, result in enumerate(torrents):
|
|
124
|
+
result['url'] = real_urls[i]
|
|
125
|
+
|
|
126
|
+
all_torrents.extend(torrents)
|
|
127
|
+
|
|
128
|
+
return all_torrents
|
|
129
|
+
|
|
130
|
+
async def main():
|
|
131
|
+
scraper = IlCorsaroNeroScraper("https://ilcorsaronero.link/")
|
|
132
|
+
results = await scraper.search("cars")
|
|
133
|
+
|
|
134
|
+
if results:
|
|
135
|
+
for i, torrent in enumerate(results):
|
|
136
|
+
console.print(f"[bold green]{i} = {torrent}[/bold green] \n")
|
|
137
|
+
else:
|
|
138
|
+
console.print("[bold red]No torrents found.[/bold red]")
|
|
139
|
+
|
|
140
|
+
if __name__ == '__main__':
|
|
141
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 26.05.24
|
|
2
|
+
|
|
3
|
+
from urllib.parse import quote_plus
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Internal utilities
|
|
7
|
+
from StreamingCommunity.Util.console import console, msg
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Logic class
|
|
11
|
+
from StreamingCommunity.Lib.TMBD import tmdb, Json_film
|
|
12
|
+
from .film import download_film
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Variable
|
|
16
|
+
indice = 9
|
|
17
|
+
_useFor = "film"
|
|
18
|
+
_deprecate = False
|
|
19
|
+
_priority = 2
|
|
20
|
+
_engineDownload = "hls"
|
|
21
|
+
from .costant import SITE_NAME
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
25
|
+
"""
|
|
26
|
+
Main function of the application for film and series.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
if string_to_search is None:
|
|
30
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
|
|
31
|
+
|
|
32
|
+
# Not available for the moment
|
|
33
|
+
if get_onylDatabase:
|
|
34
|
+
return 0
|
|
35
|
+
|
|
36
|
+
# Search on database
|
|
37
|
+
movie_id = tmdb.search_movie(quote_plus(string_to_search))
|
|
38
|
+
|
|
39
|
+
if movie_id is not None:
|
|
40
|
+
movie_details: Json_film = tmdb.get_movie_details(tmdb_id=movie_id)
|
|
41
|
+
|
|
42
|
+
# Download only film
|
|
43
|
+
download_film(movie_details)
|
|
44
|
+
|
|
45
|
+
else:
|
|
46
|
+
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
47
|
+
|
|
48
|
+
# Retry
|
|
49
|
+
search()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 26.05.24
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Internal utilities
|
|
7
|
+
from StreamingCommunity.Util._jsonConfig import config_manager
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
|
|
11
|
+
ROOT_PATH = config_manager.get('DEFAULT', 'root_path')
|
|
12
|
+
DOMAIN_NOW = config_manager.get_dict('SITE', SITE_NAME)['domain']
|
|
13
|
+
|
|
14
|
+
SERIES_FOLDER = config_manager.get('DEFAULT', 'serie_folder_name')
|
|
15
|
+
MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name')
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# 17.09.24
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# External libraries
|
|
10
|
+
import httpx
|
|
11
|
+
from bs4 import BeautifulSoup
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Internal utilities
|
|
15
|
+
from StreamingCommunity.Util.console import console, msg
|
|
16
|
+
from StreamingCommunity.Util.os import os_manager
|
|
17
|
+
from StreamingCommunity.Util.message import start_message
|
|
18
|
+
from StreamingCommunity.Util.call_stack import get_call_stack
|
|
19
|
+
from StreamingCommunity.Util.headers import get_headers
|
|
20
|
+
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Logic class
|
|
24
|
+
from StreamingCommunity.Api.Template.Util import execute_search
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Player
|
|
28
|
+
from StreamingCommunity.Api.Player.supervideo import VideoSource
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# TMBD
|
|
32
|
+
from StreamingCommunity.Lib.TMBD import Json_film
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Config
|
|
36
|
+
from .costant import ROOT_PATH, SITE_NAME, DOMAIN_NOW, MOVIE_FOLDER
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def download_film(movie_details: Json_film) -> str:
|
|
40
|
+
"""
|
|
41
|
+
Downloads a film using the provided tmbd id.
|
|
42
|
+
|
|
43
|
+
Parameters:
|
|
44
|
+
- movie_details (Json_film): Class with info about film title.
|
|
45
|
+
|
|
46
|
+
Return:
|
|
47
|
+
- str: output path
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
# Start message and display film information
|
|
51
|
+
start_message()
|
|
52
|
+
console.print(f"[yellow]Download: [red]{movie_details.title} \n")
|
|
53
|
+
|
|
54
|
+
# Make request to main site
|
|
55
|
+
try:
|
|
56
|
+
url = f"https://{SITE_NAME}.{DOMAIN_NOW}/set-movie-a/{movie_details.imdb_id}"
|
|
57
|
+
response = httpx.get(url, headers={'User-Agent': get_headers()})
|
|
58
|
+
response.raise_for_status()
|
|
59
|
+
|
|
60
|
+
except:
|
|
61
|
+
logging.error(f"Not found in the server. Dict: {movie_details}")
|
|
62
|
+
raise
|
|
63
|
+
|
|
64
|
+
# Extract supervideo url
|
|
65
|
+
soup = BeautifulSoup(response.text, "html.parser")
|
|
66
|
+
player_links = soup.find("ul", class_ = "_player-mirrors").find_all("li")
|
|
67
|
+
supervideo_url = "https:" + player_links[0].get("data-link")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# Set domain and media ID for the video source
|
|
71
|
+
video_source = VideoSource()
|
|
72
|
+
video_source.setup(supervideo_url)
|
|
73
|
+
|
|
74
|
+
# Define output path
|
|
75
|
+
title_name = os_manager.get_sanitize_file(movie_details.title) + ".mp4"
|
|
76
|
+
mp4_path = os.path.join(ROOT_PATH, MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
77
|
+
|
|
78
|
+
# Get m3u8 master playlist
|
|
79
|
+
master_playlist = video_source.get_playlist()
|
|
80
|
+
|
|
81
|
+
# Download the film using the m3u8 playlist, and output filename
|
|
82
|
+
r_proc = HLS_Downloader(
|
|
83
|
+
m3u8_playlist=master_playlist,
|
|
84
|
+
output_filename=os.path.join(mp4_path, title_name)
|
|
85
|
+
).start()
|
|
86
|
+
|
|
87
|
+
"""if r_proc == 404:
|
|
88
|
+
time.sleep(2)
|
|
89
|
+
|
|
90
|
+
# Re call search function
|
|
91
|
+
if msg.ask("[green]Do you want to continue [white]([red]y[white])[green] or return at home[white]([red]n[white]) ", choices=['y', 'n'], default='y', show_choices=True) == "n":
|
|
92
|
+
frames = get_call_stack()
|
|
93
|
+
execute_search(frames[-4])"""
|
|
94
|
+
|
|
95
|
+
if r_proc != None:
|
|
96
|
+
console.print("[green]Result: ")
|
|
97
|
+
console.print(r_proc)
|
|
98
|
+
|
|
99
|
+
return os.path.join(mp4_path, title_name)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# 21.05.24
|
|
2
|
+
|
|
3
|
+
from urllib.parse import quote_plus
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Internal utilities
|
|
7
|
+
from StreamingCommunity.Util.console import console, msg
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Logic class
|
|
11
|
+
from .site import get_version_and_domain, title_search, run_get_select_title, media_search_manager
|
|
12
|
+
from .film import download_film
|
|
13
|
+
from .series import download_series
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Variable
|
|
17
|
+
indice = 0
|
|
18
|
+
_useFor = "film_serie"
|
|
19
|
+
_deprecate = False
|
|
20
|
+
_priority = 1
|
|
21
|
+
_engineDownload = "hls"
|
|
22
|
+
from .costant import SITE_NAME
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
26
|
+
"""
|
|
27
|
+
Main function of the application for film and series.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
if string_to_search is None:
|
|
31
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
|
|
32
|
+
|
|
33
|
+
# Get site domain and version and get result of the search
|
|
34
|
+
site_version, domain = get_version_and_domain()
|
|
35
|
+
len_database = title_search(quote_plus(string_to_search), domain)
|
|
36
|
+
|
|
37
|
+
# Return list of elements
|
|
38
|
+
if get_onylDatabase:
|
|
39
|
+
return media_search_manager
|
|
40
|
+
|
|
41
|
+
if len_database > 0:
|
|
42
|
+
|
|
43
|
+
# Select title from list
|
|
44
|
+
select_title = run_get_select_title()
|
|
45
|
+
|
|
46
|
+
if select_title.type == 'tv':
|
|
47
|
+
download_series(select_title, site_version)
|
|
48
|
+
|
|
49
|
+
else:
|
|
50
|
+
download_film(select_title)
|
|
51
|
+
|
|
52
|
+
else:
|
|
53
|
+
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
54
|
+
|
|
55
|
+
# Retry
|
|
56
|
+
search()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 26.05.24
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Internal utilities
|
|
7
|
+
from StreamingCommunity.Util._jsonConfig import config_manager
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
|
|
11
|
+
ROOT_PATH = config_manager.get('DEFAULT', 'root_path')
|
|
12
|
+
DOMAIN_NOW = config_manager.get('SITE', SITE_NAME)
|
|
13
|
+
|
|
14
|
+
SERIES_FOLDER = config_manager.get('DEFAULT', 'serie_folder_name')
|
|
15
|
+
MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name')
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# 3.12.23
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Internal utilities
|
|
8
|
+
from StreamingCommunity.Util.console import console, msg
|
|
9
|
+
from StreamingCommunity.Util.os import os_manager
|
|
10
|
+
from StreamingCommunity.Util.message import start_message
|
|
11
|
+
from StreamingCommunity.Util.call_stack import get_call_stack
|
|
12
|
+
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Logic class
|
|
16
|
+
from StreamingCommunity.Api.Template.Util import execute_search
|
|
17
|
+
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Player
|
|
21
|
+
from StreamingCommunity.Api.Player.vixcloud import VideoSource
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Variable
|
|
25
|
+
from .costant import ROOT_PATH, SITE_NAME, MOVIE_FOLDER
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def download_film(select_title: MediaItem) -> str:
|
|
29
|
+
"""
|
|
30
|
+
Downloads a film using the provided film ID, title name, and domain.
|
|
31
|
+
|
|
32
|
+
Parameters:
|
|
33
|
+
- domain (str): The domain of the site
|
|
34
|
+
- version (str): Version of site.
|
|
35
|
+
|
|
36
|
+
Return:
|
|
37
|
+
- str: output path
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# Start message and display film information
|
|
41
|
+
start_message()
|
|
42
|
+
console.print(f"[yellow]Download: [red]{select_title.slug} \n")
|
|
43
|
+
|
|
44
|
+
# Init class
|
|
45
|
+
video_source = VideoSource(SITE_NAME, False)
|
|
46
|
+
video_source.setup(select_title.id)
|
|
47
|
+
|
|
48
|
+
# Retrieve scws and if available master playlist
|
|
49
|
+
video_source.get_iframe(select_title.id)
|
|
50
|
+
video_source.get_content()
|
|
51
|
+
master_playlist = video_source.get_playlist()
|
|
52
|
+
|
|
53
|
+
# Define the filename and path for the downloaded film
|
|
54
|
+
title_name = os_manager.get_sanitize_file(select_title.slug) + ".mp4"
|
|
55
|
+
mp4_path = os.path.join(ROOT_PATH, MOVIE_FOLDER, select_title.slug)
|
|
56
|
+
|
|
57
|
+
# Download the film using the m3u8 playlist, and output filename
|
|
58
|
+
r_proc = HLS_Downloader(
|
|
59
|
+
m3u8_playlist=master_playlist,
|
|
60
|
+
output_filename=os.path.join(mp4_path, title_name)
|
|
61
|
+
).start()
|
|
62
|
+
|
|
63
|
+
"""if r_proc == 404:
|
|
64
|
+
time.sleep(2)
|
|
65
|
+
|
|
66
|
+
# Re call search function
|
|
67
|
+
if msg.ask("[green]Do you want to continue [white]([red]y[white])[green] or return at home[white]([red]n[white]) ", choices=['y', 'n'], default='y', show_choices=True) == "n":
|
|
68
|
+
frames = get_call_stack()
|
|
69
|
+
execute_search(frames[-4])"""
|
|
70
|
+
|
|
71
|
+
if r_proc != None:
|
|
72
|
+
console.print("[green]Result: ")
|
|
73
|
+
console.print(r_proc)
|
|
74
|
+
|
|
75
|
+
return os.path.join(mp4_path, title_name)
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# 3.12.23
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Internal utilities
|
|
9
|
+
from StreamingCommunity.Util.console import console, msg
|
|
10
|
+
from StreamingCommunity.Util.message import start_message
|
|
11
|
+
from StreamingCommunity.Util.call_stack import get_call_stack
|
|
12
|
+
from StreamingCommunity.Util.table import TVShowManager
|
|
13
|
+
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Logic class
|
|
17
|
+
from .util.ScrapeSerie import ScrapeSerie
|
|
18
|
+
from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
|
|
19
|
+
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Player
|
|
23
|
+
from StreamingCommunity.Api.Player.vixcloud import VideoSource
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Variable
|
|
27
|
+
from .costant import ROOT_PATH, SITE_NAME, SERIES_FOLDER
|
|
28
|
+
table_show_manager = TVShowManager()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def download_video(index_season_selected: int, index_episode_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource) -> str:
|
|
33
|
+
"""
|
|
34
|
+
Download a single episode video.
|
|
35
|
+
|
|
36
|
+
Parameters:
|
|
37
|
+
- index_season_selected (int): Index of the selected season.
|
|
38
|
+
- index_episode_selected (int): Index of the selected episode.
|
|
39
|
+
|
|
40
|
+
Return:
|
|
41
|
+
- str: output path
|
|
42
|
+
"""
|
|
43
|
+
start_message()
|
|
44
|
+
|
|
45
|
+
# Get info about episode
|
|
46
|
+
obj_episode = scrape_serie.episode_manager.get(index_episode_selected - 1)
|
|
47
|
+
console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.name}")
|
|
48
|
+
print()
|
|
49
|
+
|
|
50
|
+
# Define filename and path for the downloaded video
|
|
51
|
+
mp4_name = f"{map_episode_title(scrape_serie.series_name, index_season_selected, index_episode_selected, obj_episode.name)}.mp4"
|
|
52
|
+
mp4_path = os.path.join(ROOT_PATH, SERIES_FOLDER, scrape_serie.series_name, f"S{index_season_selected}")
|
|
53
|
+
|
|
54
|
+
# Retrieve scws and if available master playlist
|
|
55
|
+
video_source.get_iframe(obj_episode.id)
|
|
56
|
+
video_source.get_content()
|
|
57
|
+
master_playlist = video_source.get_playlist()
|
|
58
|
+
|
|
59
|
+
# Download the episode
|
|
60
|
+
r_proc = HLS_Downloader(
|
|
61
|
+
m3u8_playlist=master_playlist,
|
|
62
|
+
output_filename=os.path.join(mp4_path, mp4_name)
|
|
63
|
+
).start()
|
|
64
|
+
|
|
65
|
+
"""if r_proc == 404:
|
|
66
|
+
time.sleep(2)
|
|
67
|
+
|
|
68
|
+
# Re call search function
|
|
69
|
+
if msg.ask("[green]Do you want to continue [white]([red]y[white])[green] or return at home[white]([red]n[white]) ", choices=['y', 'n'], default='y', show_choices=True) == "n":
|
|
70
|
+
frames = get_call_stack()
|
|
71
|
+
execute_search(frames[-4])"""
|
|
72
|
+
|
|
73
|
+
if r_proc != None:
|
|
74
|
+
console.print("[green]Result: ")
|
|
75
|
+
console.print(r_proc)
|
|
76
|
+
|
|
77
|
+
return os.path.join(mp4_path, mp4_name)
|
|
78
|
+
|
|
79
|
+
def download_episode(index_season_selected: int, scrape_serie: ScrapeSerie, video_source: VideoSource, download_all: bool = False) -> None:
|
|
80
|
+
"""
|
|
81
|
+
Download episodes of a selected season.
|
|
82
|
+
|
|
83
|
+
Parameters:
|
|
84
|
+
- index_season_selected (int): Index of the selected season.
|
|
85
|
+
- download_all (bool): Download all episodes in the season.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
# Clean memory of all episodes and get the number of the season
|
|
89
|
+
scrape_serie.episode_manager.clear()
|
|
90
|
+
|
|
91
|
+
# Start message and collect information about episodes
|
|
92
|
+
start_message()
|
|
93
|
+
scrape_serie.collect_info_season(index_season_selected)
|
|
94
|
+
episodes_count = scrape_serie.episode_manager.length()
|
|
95
|
+
|
|
96
|
+
if download_all:
|
|
97
|
+
|
|
98
|
+
# Download all episodes without asking
|
|
99
|
+
for i_episode in range(1, episodes_count + 1):
|
|
100
|
+
download_video(index_season_selected, i_episode, scrape_serie, video_source)
|
|
101
|
+
console.print(f"\n[red]End downloaded [yellow]season: [red]{index_season_selected}.")
|
|
102
|
+
|
|
103
|
+
else:
|
|
104
|
+
|
|
105
|
+
# Display episodes list and manage user selection
|
|
106
|
+
last_command = display_episodes_list(scrape_serie)
|
|
107
|
+
list_episode_select = manage_selection(last_command, episodes_count)
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
list_episode_select = validate_episode_selection(list_episode_select, episodes_count)
|
|
111
|
+
except ValueError as e:
|
|
112
|
+
console.print(f"[red]{str(e)}")
|
|
113
|
+
return
|
|
114
|
+
|
|
115
|
+
# Download selected episodes
|
|
116
|
+
for i_episode in list_episode_select:
|
|
117
|
+
download_video(index_season_selected, i_episode, scrape_serie, video_source)
|
|
118
|
+
|
|
119
|
+
def download_series(select_season: MediaItem, version: str) -> None:
|
|
120
|
+
"""
|
|
121
|
+
Download episodes of a TV series based on user selection.
|
|
122
|
+
|
|
123
|
+
Parameters:
|
|
124
|
+
- select_season (MediaItem): Selected media item (TV series).
|
|
125
|
+
- domain (str): Domain from which to download.
|
|
126
|
+
- version (str): Version of the site.
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
# Start message and set up video source
|
|
130
|
+
start_message()
|
|
131
|
+
|
|
132
|
+
# Init class
|
|
133
|
+
scrape_serie = ScrapeSerie(SITE_NAME)
|
|
134
|
+
video_source = VideoSource(SITE_NAME, True)
|
|
135
|
+
|
|
136
|
+
# Setup video source
|
|
137
|
+
scrape_serie.setup(version, select_season.id, select_season.slug)
|
|
138
|
+
video_source.setup(select_season.id)
|
|
139
|
+
|
|
140
|
+
# Collect information about seasons
|
|
141
|
+
scrape_serie.collect_info_title()
|
|
142
|
+
seasons_count = scrape_serie.season_manager.seasons_count
|
|
143
|
+
|
|
144
|
+
# Prompt user for season selection and download episodes
|
|
145
|
+
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
|
|
146
|
+
index_season_selected = msg.ask(
|
|
147
|
+
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
|
|
148
|
+
"[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# Manage and validate the selection
|
|
152
|
+
list_season_select = manage_selection(index_season_selected, seasons_count)
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
list_season_select = validate_selection(list_season_select, seasons_count)
|
|
156
|
+
except ValueError as e:
|
|
157
|
+
console.print(f"[red]{str(e)}")
|
|
158
|
+
return
|
|
159
|
+
|
|
160
|
+
# Loop through the selected seasons and download episodes
|
|
161
|
+
for i_season in list_season_select:
|
|
162
|
+
if len(list_season_select) > 1 or index_season_selected == "*":
|
|
163
|
+
|
|
164
|
+
# Download all episodes if multiple seasons are selected or if '*' is used
|
|
165
|
+
download_episode(i_season, scrape_serie, video_source, download_all=True)
|
|
166
|
+
else:
|
|
167
|
+
|
|
168
|
+
# Otherwise, let the user select specific episodes for the single season
|
|
169
|
+
download_episode(i_season, scrape_serie, video_source, download_all=False)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def display_episodes_list(scrape_serie) -> str:
|
|
173
|
+
"""
|
|
174
|
+
Display episodes list and handle user input.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
last_command (str): Last command entered by the user.
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
# Set up table for displaying episodes
|
|
181
|
+
table_show_manager.set_slice_end(10)
|
|
182
|
+
|
|
183
|
+
# Add columns to the table
|
|
184
|
+
column_info = {
|
|
185
|
+
"Index": {'color': 'red'},
|
|
186
|
+
"Name": {'color': 'magenta'},
|
|
187
|
+
"Duration": {'color': 'green'}
|
|
188
|
+
}
|
|
189
|
+
table_show_manager.add_column(column_info)
|
|
190
|
+
|
|
191
|
+
# Populate the table with episodes information
|
|
192
|
+
for i, media in enumerate(scrape_serie.episode_manager.episodes):
|
|
193
|
+
table_show_manager.add_tv_show({
|
|
194
|
+
'Index': str(media.number),
|
|
195
|
+
'Name': media.name,
|
|
196
|
+
'Duration': str(media.duration)
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
# Run the table and handle user input
|
|
200
|
+
last_command = table_show_manager.run()
|
|
201
|
+
|
|
202
|
+
if last_command == "q":
|
|
203
|
+
console.print("\n[red]Quit [white]...")
|
|
204
|
+
sys.exit(0)
|
|
205
|
+
|
|
206
|
+
return last_command
|