StreamingCommunity 2.9.4__py3-none-any.whl → 2.9.6__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/sweetpixel.py +49 -0
- StreamingCommunity/Api/Site/1337xx/__init__.py +26 -12
- StreamingCommunity/Api/Site/1337xx/site.py +5 -4
- StreamingCommunity/Api/Site/1337xx/title.py +4 -6
- StreamingCommunity/Api/Site/altadefinizione/__init__.py +64 -17
- StreamingCommunity/Api/Site/altadefinizione/film.py +32 -2
- StreamingCommunity/Api/Site/altadefinizione/series.py +54 -10
- StreamingCommunity/Api/Site/altadefinizione/site.py +25 -7
- StreamingCommunity/Api/Site/altadefinizione/util/ScrapeSerie.py +2 -2
- StreamingCommunity/Api/Site/animeunity/__init__.py +53 -32
- StreamingCommunity/Api/Site/animeunity/film_serie.py +8 -5
- StreamingCommunity/Api/Site/animeunity/site.py +4 -6
- StreamingCommunity/Api/Site/animeworld/__init__.py +71 -0
- StreamingCommunity/Api/Site/animeworld/serie.py +107 -0
- StreamingCommunity/Api/Site/animeworld/site.py +111 -0
- StreamingCommunity/Api/Site/animeworld/util/ScrapeSerie.py +79 -0
- StreamingCommunity/Api/Site/cb01new/__init__.py +26 -14
- StreamingCommunity/Api/Site/cb01new/film.py +1 -1
- StreamingCommunity/Api/Site/cb01new/site.py +9 -7
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +26 -15
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +2 -2
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +3 -3
- StreamingCommunity/Api/Site/guardaserie/__init__.py +23 -11
- StreamingCommunity/Api/Site/guardaserie/series.py +1 -1
- StreamingCommunity/Api/Site/guardaserie/site.py +5 -4
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +27 -7
- StreamingCommunity/Api/Site/mostraguarda/film.py +1 -1
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +50 -27
- StreamingCommunity/Api/Site/streamingcommunity/film.py +1 -1
- StreamingCommunity/Api/Site/streamingcommunity/series.py +6 -3
- StreamingCommunity/Api/Site/streamingcommunity/site.py +7 -3
- StreamingCommunity/Lib/Downloader/HLS/segments.py +2 -4
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +7 -6
- StreamingCommunity/Lib/Downloader/TOR/downloader.py +397 -227
- StreamingCommunity/Lib/FFmpeg/util.py +12 -0
- StreamingCommunity/Lib/M3U8/estimator.py +5 -8
- StreamingCommunity/Upload/version.py +1 -1
- StreamingCommunity/Util/config_json.py +2 -8
- StreamingCommunity/Util/table.py +12 -2
- StreamingCommunity/global_search.py +315 -0
- StreamingCommunity/run.py +39 -5
- {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/METADATA +42 -15
- streamingcommunity-2.9.6.dist-info/RECORD +85 -0
- {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/WHEEL +1 -1
- streamingcommunity-2.9.4.dist-info/RECORD +0 -79
- {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/entry_points.txt +0 -0
- {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info/licenses}/LICENSE +0 -0
- {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 21.03.25
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# External libraries
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Internal utilities
|
|
11
|
+
from StreamingCommunity.Util.config_json import config_manager
|
|
12
|
+
from StreamingCommunity.Util.headers import get_userAgent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Variable
|
|
16
|
+
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AnimeWorldPlayer:
|
|
20
|
+
def __init__(self, full_url, episode_data, session_id, csrf_token):
|
|
21
|
+
"""Initialize the AnimeWorldPlayer with session details, episode data, and URL."""
|
|
22
|
+
self.session_id = session_id
|
|
23
|
+
self.csrf_token = csrf_token
|
|
24
|
+
self.episode_data = episode_data
|
|
25
|
+
self.number = episode_data['number']
|
|
26
|
+
self.link = episode_data['link']
|
|
27
|
+
|
|
28
|
+
# Create an HTTP client with session cookies, headers, and base URL.
|
|
29
|
+
self.client = httpx.Client(
|
|
30
|
+
cookies={"sessionId": session_id},
|
|
31
|
+
headers={"User-Agent": get_userAgent(), "csrf-token": csrf_token},
|
|
32
|
+
base_url=full_url,
|
|
33
|
+
timeout=MAX_TIMEOUT
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def get_download_link(self):
|
|
37
|
+
"""Fetch the download link from AnimeWorld using the episode link."""
|
|
38
|
+
try:
|
|
39
|
+
# Make a POST request to the episode link and follow any redirects
|
|
40
|
+
res = self.client.post(self.link, follow_redirects=True)
|
|
41
|
+
data = res.json()
|
|
42
|
+
|
|
43
|
+
# Extract the first available server link and return it after modifying the URL
|
|
44
|
+
server_link = data["links"]["9"][list(data["links"]["9"].keys())[0]]["link"]
|
|
45
|
+
return server_link.replace('download-file.php?id=', '')
|
|
46
|
+
|
|
47
|
+
except Exception as e:
|
|
48
|
+
logging.error(f"Error in new API system: {e}")
|
|
49
|
+
return None
|
|
@@ -10,10 +10,11 @@ from rich.prompt import Prompt
|
|
|
10
10
|
|
|
11
11
|
# Internal utilities
|
|
12
12
|
from StreamingCommunity.Api.Template import get_select_title
|
|
13
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
14
|
+
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
# Logic class
|
|
16
|
-
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
17
18
|
from .site import title_search, media_search_manager, table_show_manager
|
|
18
19
|
from .title import download_title
|
|
19
20
|
|
|
@@ -29,30 +30,43 @@ console = Console()
|
|
|
29
30
|
msg = Prompt()
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
def process_search_result(select_title):
|
|
35
|
+
"""
|
|
36
|
+
Handles the search result and initiates the download for either a film or series.
|
|
37
|
+
"""
|
|
38
|
+
download_title(select_title)
|
|
39
|
+
|
|
40
|
+
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None):
|
|
33
41
|
"""
|
|
34
|
-
Main function of the application for film and
|
|
42
|
+
Main function of the application for search film, series and anime.
|
|
43
|
+
|
|
44
|
+
Parameters:
|
|
45
|
+
string_to_search (str, optional): String to search for
|
|
46
|
+
get_onylDatabase (bool, optional): If True, return only the database object
|
|
47
|
+
direct_item (dict, optional): Direct item to process (bypass search)
|
|
35
48
|
"""
|
|
49
|
+
if direct_item:
|
|
50
|
+
select_title = MediaItem(**direct_item)
|
|
51
|
+
process_search_result(select_title)
|
|
52
|
+
return
|
|
53
|
+
|
|
36
54
|
if string_to_search is None:
|
|
37
55
|
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
38
56
|
|
|
39
|
-
#
|
|
57
|
+
# Perform the database search
|
|
40
58
|
len_database = title_search(quote_plus(string_to_search))
|
|
41
59
|
|
|
42
|
-
#
|
|
43
|
-
if
|
|
60
|
+
# If only the database is needed, return the manager
|
|
61
|
+
if get_onlyDatabase:
|
|
44
62
|
return media_search_manager
|
|
45
63
|
|
|
46
64
|
if len_database > 0:
|
|
47
|
-
|
|
48
|
-
# Select title from list
|
|
49
65
|
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
50
|
-
|
|
51
|
-
# Download title
|
|
52
66
|
download_title(select_title)
|
|
53
67
|
|
|
54
68
|
else:
|
|
55
|
-
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
56
69
|
|
|
57
|
-
#
|
|
70
|
+
# If no results are found, ask again
|
|
71
|
+
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
58
72
|
search()
|
|
@@ -26,12 +26,12 @@ table_show_manager = TVShowManager()
|
|
|
26
26
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def title_search(
|
|
29
|
+
def title_search(query: str) -> int:
|
|
30
30
|
"""
|
|
31
31
|
Search for titles based on a search query.
|
|
32
32
|
|
|
33
33
|
Parameters:
|
|
34
|
-
-
|
|
34
|
+
- query (str): The query to search for.
|
|
35
35
|
|
|
36
36
|
Returns:
|
|
37
37
|
- int: The number of titles found.
|
|
@@ -39,7 +39,7 @@ def title_search(word_to_search: str) -> int:
|
|
|
39
39
|
media_search_manager.clear()
|
|
40
40
|
table_show_manager.clear()
|
|
41
41
|
|
|
42
|
-
search_url = f"{site_constant.FULL_URL}/search/{
|
|
42
|
+
search_url = f"{site_constant.FULL_URL}/search/{query}/1/"
|
|
43
43
|
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
|
44
44
|
|
|
45
45
|
try:
|
|
@@ -62,7 +62,8 @@ def title_search(word_to_search: str) -> int:
|
|
|
62
62
|
'seader': tr.find_all("td")[-5].get_text(strip=True),
|
|
63
63
|
'leacher': tr.find_all("td")[-4].get_text(strip=True),
|
|
64
64
|
'date': tr.find_all("td")[-3].get_text(strip=True).replace("'", ""),
|
|
65
|
-
'size': tr.find_all("td")[-2].get_text(strip=True)
|
|
65
|
+
'size': tr.find_all("td")[-2].get_text(strip=True),
|
|
66
|
+
'type': 'torrent'
|
|
66
67
|
}
|
|
67
68
|
media_search_manager.add_media(title_info)
|
|
68
69
|
|
|
@@ -33,9 +33,8 @@ def download_title(select_title: MediaItem):
|
|
|
33
33
|
- select_title (MediaItem): The media item to be downloaded. This should be an instance of the MediaItem class, containing attributes like `name` and `url`.
|
|
34
34
|
"""
|
|
35
35
|
start_message()
|
|
36
|
-
console.print(f"[yellow]Download:
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
|
|
37
|
+
|
|
39
38
|
# Define output path
|
|
40
39
|
title_name = os_manager.get_sanitize_file(select_title.name)
|
|
41
40
|
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
@@ -58,6 +57,5 @@ def download_title(select_title: MediaItem):
|
|
|
58
57
|
|
|
59
58
|
# Tor manager
|
|
60
59
|
manager = TOR_downloader()
|
|
61
|
-
manager.add_magnet_link(final_url)
|
|
62
|
-
manager.start_download()
|
|
63
|
-
manager.move_downloaded_files(mp4_path)
|
|
60
|
+
manager.add_magnet_link(final_url, save_path=mp4_path)
|
|
61
|
+
manager.start_download()
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 16.03.25
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
3
5
|
from urllib.parse import quote_plus
|
|
4
6
|
|
|
5
7
|
|
|
@@ -10,15 +12,16 @@ from rich.prompt import Prompt
|
|
|
10
12
|
|
|
11
13
|
# Internal utilities
|
|
12
14
|
from StreamingCommunity.Api.Template import get_select_title
|
|
15
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
16
|
+
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
17
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
# Logic class
|
|
16
|
-
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
17
21
|
from .site import title_search, table_show_manager, media_search_manager
|
|
18
22
|
from .film import download_film
|
|
19
23
|
from .series import download_series
|
|
20
24
|
|
|
21
|
-
|
|
22
25
|
# Variable
|
|
23
26
|
indice = 2
|
|
24
27
|
_useFor = "film_serie"
|
|
@@ -30,32 +33,76 @@ msg = Prompt()
|
|
|
30
33
|
console = Console()
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
def
|
|
36
|
+
def get_user_input(string_to_search: str = None):
|
|
34
37
|
"""
|
|
35
|
-
|
|
38
|
+
Asks the user to input a search term.
|
|
39
|
+
Handles both Telegram bot input and direct input.
|
|
36
40
|
"""
|
|
37
41
|
if string_to_search is None:
|
|
38
|
-
|
|
42
|
+
if site_constant.TELEGRAM_BOT:
|
|
43
|
+
bot = get_bot_instance()
|
|
44
|
+
string_to_search = bot.ask(
|
|
45
|
+
"key_search",
|
|
46
|
+
f"Enter the search term\nor type 'back' to return to the menu: ",
|
|
47
|
+
None
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
if string_to_search == 'back':
|
|
51
|
+
|
|
52
|
+
# Restart the script
|
|
53
|
+
subprocess.Popen([sys.executable] + sys.argv)
|
|
54
|
+
sys.exit()
|
|
55
|
+
else:
|
|
56
|
+
string_to_search = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
57
|
+
|
|
58
|
+
return string_to_search
|
|
59
|
+
|
|
60
|
+
def process_search_result(select_title):
|
|
61
|
+
"""
|
|
62
|
+
Handles the search result and initiates the download for either a film or series.
|
|
63
|
+
"""
|
|
64
|
+
if select_title.type == 'tv':
|
|
65
|
+
download_series(select_title)
|
|
66
|
+
else:
|
|
67
|
+
download_film(select_title)
|
|
68
|
+
|
|
69
|
+
def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None):
|
|
70
|
+
"""
|
|
71
|
+
Main function of the application for search film, series and anime.
|
|
39
72
|
|
|
73
|
+
Parameters:
|
|
74
|
+
string_to_search (str, optional): String to search for
|
|
75
|
+
get_onylDatabase (bool, optional): If True, return only the database object
|
|
76
|
+
direct_item (dict, optional): Direct item to process (bypass search)
|
|
77
|
+
"""
|
|
78
|
+
if direct_item:
|
|
79
|
+
select_title = MediaItem(**direct_item)
|
|
80
|
+
process_search_result(select_title)
|
|
81
|
+
return
|
|
82
|
+
|
|
83
|
+
# Get the user input for the search term
|
|
84
|
+
string_to_search = get_user_input(string_to_search)
|
|
85
|
+
|
|
86
|
+
# Perform the database search
|
|
40
87
|
len_database = title_search(quote_plus(string_to_search))
|
|
41
88
|
|
|
42
|
-
#
|
|
43
|
-
if
|
|
89
|
+
# If only the database is needed, return the manager
|
|
90
|
+
if get_onlyDatabase:
|
|
44
91
|
return media_search_manager
|
|
45
92
|
|
|
93
|
+
if site_constant.TELEGRAM_BOT:
|
|
94
|
+
bot = get_bot_instance()
|
|
95
|
+
|
|
46
96
|
if len_database > 0:
|
|
47
|
-
|
|
48
|
-
# Select title from list
|
|
49
97
|
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
50
|
-
|
|
51
|
-
if select_title.type == 'tv':
|
|
52
|
-
download_series(select_title)
|
|
53
|
-
|
|
54
|
-
else:
|
|
55
|
-
download_film(select_title)
|
|
98
|
+
process_search_result(select_title)
|
|
56
99
|
|
|
57
100
|
else:
|
|
58
101
|
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
59
102
|
|
|
60
|
-
|
|
103
|
+
if site_constant.TELEGRAM_BOT:
|
|
104
|
+
bot.send_message(f"No results found, please try again", None)
|
|
105
|
+
|
|
106
|
+
# If no results are found, ask again
|
|
107
|
+
string_to_search = get_user_input()
|
|
61
108
|
search()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 16.03.25
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ from StreamingCommunity.Util.message import start_message
|
|
|
15
15
|
from StreamingCommunity.Util.headers import get_headers
|
|
16
16
|
from StreamingCommunity.Util.config_json import config_manager
|
|
17
17
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
18
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
# Logic class
|
|
@@ -41,8 +42,21 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
41
42
|
Return:
|
|
42
43
|
- str: output path if successful, otherwise None
|
|
43
44
|
"""
|
|
45
|
+
|
|
46
|
+
if site_constant.TELEGRAM_BOT:
|
|
47
|
+
bot = get_bot_instance()
|
|
48
|
+
bot.send_message(f"Download in corso:\n{select_title.name}", None)
|
|
49
|
+
|
|
50
|
+
# Viene usato per lo screen
|
|
51
|
+
console.print(f"## Download: [red]{select_title.name} ##")
|
|
52
|
+
|
|
53
|
+
# Get script_id
|
|
54
|
+
script_id = TelegramSession.get_session()
|
|
55
|
+
if script_id != "unknown":
|
|
56
|
+
TelegramSession.updateScriptId(script_id, select_title.name)
|
|
57
|
+
|
|
44
58
|
start_message()
|
|
45
|
-
console.print(f"[yellow]Download: [red]{select_title.name} \n")
|
|
59
|
+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
|
|
46
60
|
|
|
47
61
|
# Extract mostraguarda link
|
|
48
62
|
try:
|
|
@@ -51,6 +65,9 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
51
65
|
|
|
52
66
|
except Exception as e:
|
|
53
67
|
console.print(f"[red]Error fetching the page: {e}")
|
|
68
|
+
|
|
69
|
+
if site_constant.TELEGRAM_BOT:
|
|
70
|
+
bot.send_message(f"ERRORE\n\nErrore durante il recupero della pagina.\n\n{e}", None)
|
|
54
71
|
return None
|
|
55
72
|
|
|
56
73
|
# Create mostraguarda url
|
|
@@ -59,6 +76,8 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
59
76
|
url_mostraGuarda = iframe_tag[0].get('data-src')
|
|
60
77
|
if not url_mostraGuarda:
|
|
61
78
|
console.print("Error: data-src attribute not found in iframe.")
|
|
79
|
+
if site_constant.TELEGRAM_BOT:
|
|
80
|
+
bot.send_message(f"ERRORE\n\nErrore: attributo data-src non trovato nell'iframe", None)
|
|
62
81
|
|
|
63
82
|
# Extract supervideo URL
|
|
64
83
|
try:
|
|
@@ -67,6 +86,10 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
67
86
|
|
|
68
87
|
except Exception as e:
|
|
69
88
|
console.print(f"[red]Error fetching mostraguarda link: {e}")
|
|
89
|
+
console.print("[yellow]Missing access credentials. This part of the code is still under development.")
|
|
90
|
+
if site_constant.TELEGRAM_BOT:
|
|
91
|
+
bot.send_message(f"ERRORE\n\nErrore durante il recupero del link mostra/guarda.\n\n{e}", None)
|
|
92
|
+
bot.send_message(f"ERRORE\n\nCredenziali di accesso mancanti.\nQuesta parte del codice è ancora in fase di sviluppo.", None)
|
|
70
93
|
return None
|
|
71
94
|
|
|
72
95
|
# Create supervio URL
|
|
@@ -91,6 +114,13 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
91
114
|
output_path=os.path.join(mp4_path, title_name)
|
|
92
115
|
).start()
|
|
93
116
|
|
|
117
|
+
if site_constant.TELEGRAM_BOT:
|
|
118
|
+
|
|
119
|
+
# Delete script_id
|
|
120
|
+
script_id = TelegramSession.get_session()
|
|
121
|
+
if script_id != "unknown":
|
|
122
|
+
TelegramSession.deleteScriptId(script_id)
|
|
123
|
+
|
|
94
124
|
if r_proc['error'] is not None:
|
|
95
125
|
try: os.remove(r_proc['path'])
|
|
96
126
|
except: pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 16.03.25
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from typing import Tuple
|
|
@@ -12,6 +12,8 @@ from rich.prompt import Prompt
|
|
|
12
12
|
# Internal utilities
|
|
13
13
|
from StreamingCommunity.Util.message import start_message
|
|
14
14
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
15
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
# Logic class
|
|
17
19
|
from .util.ScrapeSerie import GetSerieInfo
|
|
@@ -53,12 +55,25 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
|
|
|
53
55
|
|
|
54
56
|
# Get info about episode
|
|
55
57
|
obj_episode = scrape_serie.seasons_manager.get_season_by_number(int(index_season_selected)).episodes.get(index_episode_selected-1)
|
|
56
|
-
console.print(f"[yellow]Download: [red]{
|
|
57
|
-
|
|
58
|
+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [bold magenta]{obj_episode.name}[/bold magenta] ([cyan]S{index_season_selected}E{index_episode_selected}[/cyan]) \n")
|
|
59
|
+
|
|
60
|
+
if site_constant.TELEGRAM_BOT:
|
|
61
|
+
bot = get_bot_instance()
|
|
62
|
+
|
|
63
|
+
# Invio a telegram
|
|
64
|
+
bot.send_message(
|
|
65
|
+
f"Download in corso\nSerie: {scrape_serie.series_name}\nStagione: {index_season_selected}\nEpisodio: {index_episode_selected}\nTitolo: {obj_episode.name}",
|
|
66
|
+
None
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Get script_id and update it
|
|
70
|
+
script_id = TelegramSession.get_session()
|
|
71
|
+
if script_id != "unknown":
|
|
72
|
+
TelegramSession.updateScriptId(script_id, f"{scrape_serie.series_name} - S{index_season_selected} - E{index_episode_selected} - {obj_episode.name}")
|
|
58
73
|
|
|
59
74
|
# Define filename and path for the downloaded video
|
|
60
|
-
mp4_name = f"{map_episode_title(scrape_serie.
|
|
61
|
-
mp4_path = os.path.join(site_constant.SERIES_FOLDER, scrape_serie.
|
|
75
|
+
mp4_name = f"{map_episode_title(scrape_serie.series_name, index_season_selected, index_episode_selected, obj_episode.name)}.mp4"
|
|
76
|
+
mp4_path = os.path.join(site_constant.SERIES_FOLDER, scrape_serie.series_name, f"S{index_season_selected}")
|
|
62
77
|
|
|
63
78
|
# Retrieve scws and if available master playlist
|
|
64
79
|
video_source = VideoSource(obj_episode.url)
|
|
@@ -127,6 +142,9 @@ def download_series(select_season: MediaItem) -> None:
|
|
|
127
142
|
Parameters:
|
|
128
143
|
- select_season (MediaItem): Selected media item (TV series).
|
|
129
144
|
"""
|
|
145
|
+
if site_constant.TELEGRAM_BOT:
|
|
146
|
+
bot = get_bot_instance()
|
|
147
|
+
|
|
130
148
|
start_message()
|
|
131
149
|
|
|
132
150
|
# Init class
|
|
@@ -138,10 +156,28 @@ def download_series(select_season: MediaItem) -> None:
|
|
|
138
156
|
|
|
139
157
|
# Prompt user for season selection and download episodes
|
|
140
158
|
console.print(f"\n[green]Seasons found: [red]{seasons_count}")
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"[
|
|
144
|
-
|
|
159
|
+
|
|
160
|
+
if site_constant.TELEGRAM_BOT:
|
|
161
|
+
console.print("\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
|
|
162
|
+
"[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")
|
|
163
|
+
|
|
164
|
+
bot.send_message(f"Stagioni trovate: {seasons_count}", None)
|
|
165
|
+
|
|
166
|
+
index_season_selected = bot.ask(
|
|
167
|
+
"select_title_episode",
|
|
168
|
+
"Menu di selezione delle stagioni\n\n"
|
|
169
|
+
"- Inserisci il numero della stagione (ad esempio, 1)\n"
|
|
170
|
+
"- Inserisci * per scaricare tutte le stagioni\n"
|
|
171
|
+
"- Inserisci un intervallo di stagioni (ad esempio, 1-2) per scaricare da una stagione all'altra\n"
|
|
172
|
+
"- Inserisci (ad esempio, 3-*) per scaricare dalla stagione specificata fino alla fine della serie",
|
|
173
|
+
None
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
else:
|
|
177
|
+
index_season_selected = msg.ask(
|
|
178
|
+
"\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
|
|
179
|
+
"[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"
|
|
180
|
+
)
|
|
145
181
|
|
|
146
182
|
# Manage and validate the selection
|
|
147
183
|
list_season_select = manage_selection(index_season_selected, seasons_count)
|
|
@@ -161,4 +197,12 @@ def download_series(select_season: MediaItem) -> None:
|
|
|
161
197
|
else:
|
|
162
198
|
|
|
163
199
|
# Otherwise, let the user select specific episodes for the single season
|
|
164
|
-
download_episode(i_season, scrape_serie, download_all=False)
|
|
200
|
+
download_episode(i_season, scrape_serie, download_all=False)
|
|
201
|
+
|
|
202
|
+
if site_constant.TELEGRAM_BOT:
|
|
203
|
+
bot.send_message(f"Finito di scaricare tutte le serie e episodi", None)
|
|
204
|
+
|
|
205
|
+
# Get script_id
|
|
206
|
+
script_id = TelegramSession.get_session()
|
|
207
|
+
if script_id != "unknown":
|
|
208
|
+
TelegramSession.deleteScriptId(script_id)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 16.03.25
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
# External libraries
|
|
@@ -11,6 +11,7 @@ from rich.console import Console
|
|
|
11
11
|
from StreamingCommunity.Util.config_json import config_manager
|
|
12
12
|
from StreamingCommunity.Util.headers import get_userAgent
|
|
13
13
|
from StreamingCommunity.Util.table import TVShowManager
|
|
14
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
# Logic class
|
|
@@ -25,20 +26,23 @@ table_show_manager = TVShowManager()
|
|
|
25
26
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
def title_search(
|
|
29
|
+
def title_search(query: str) -> int:
|
|
29
30
|
"""
|
|
30
31
|
Search for titles based on a search query.
|
|
31
32
|
|
|
32
33
|
Parameters:
|
|
33
|
-
-
|
|
34
|
+
- query (str): The query to search for.
|
|
34
35
|
|
|
35
36
|
Returns:
|
|
36
37
|
int: The number of titles found.
|
|
37
38
|
"""
|
|
39
|
+
if site_constant.TELEGRAM_BOT:
|
|
40
|
+
bot = get_bot_instance()
|
|
41
|
+
|
|
38
42
|
media_search_manager.clear()
|
|
39
43
|
table_show_manager.clear()
|
|
40
44
|
|
|
41
|
-
search_url = f"{site_constant.FULL_URL}/?story={
|
|
45
|
+
search_url = f"{site_constant.FULL_URL}/?story={query}&do=search&subaction=search"
|
|
42
46
|
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
|
43
47
|
|
|
44
48
|
try:
|
|
@@ -47,14 +51,20 @@ def title_search(title_search: str) -> int:
|
|
|
47
51
|
|
|
48
52
|
except Exception as e:
|
|
49
53
|
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
|
54
|
+
if site_constant.TELEGRAM_BOT:
|
|
55
|
+
bot.send_message(f"ERRORE\n\nErrore nella richiesta di ricerca:\n\n{e}", None)
|
|
50
56
|
return 0
|
|
51
|
-
|
|
57
|
+
|
|
58
|
+
# Prepara le scelte per l'utente
|
|
59
|
+
if site_constant.TELEGRAM_BOT:
|
|
60
|
+
choices = []
|
|
61
|
+
|
|
52
62
|
# Create soup istance
|
|
53
63
|
soup = BeautifulSoup(response.text, "html.parser")
|
|
54
64
|
|
|
55
65
|
# Collect data from soup
|
|
56
|
-
for movie_div in soup.find_all("div", class_="movie"):
|
|
57
|
-
|
|
66
|
+
for i, movie_div in enumerate(soup.find_all("div", class_="movie")):
|
|
67
|
+
|
|
58
68
|
title_tag = movie_div.find("h2", class_="movie-title")
|
|
59
69
|
title = title_tag.find("a").get_text(strip=True)
|
|
60
70
|
url = title_tag.find("a").get("href")
|
|
@@ -70,6 +80,14 @@ def title_search(title_search: str) -> int:
|
|
|
70
80
|
'name': title,
|
|
71
81
|
'type': tipo
|
|
72
82
|
})
|
|
83
|
+
|
|
84
|
+
if site_constant.TELEGRAM_BOT:
|
|
85
|
+
choice_text = f"{i} - {title} ({tipo})"
|
|
86
|
+
choices.append(choice_text)
|
|
87
|
+
|
|
88
|
+
if site_constant.TELEGRAM_BOT:
|
|
89
|
+
if choices:
|
|
90
|
+
bot.send_message(f"Lista dei risultati:", choices)
|
|
73
91
|
|
|
74
92
|
# Return the number of titles found
|
|
75
93
|
return media_search_manager.get_length()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 16.03.25
|
|
2
2
|
|
|
3
3
|
# External libraries
|
|
4
4
|
import httpx
|
|
@@ -34,7 +34,7 @@ class GetSerieInfo:
|
|
|
34
34
|
"""
|
|
35
35
|
response = httpx.get(self.url, headers=self.headers)
|
|
36
36
|
soup = BeautifulSoup(response.text, "html.parser")
|
|
37
|
-
self.
|
|
37
|
+
self.series_name = soup.find("title").get_text(strip=True).split(" - ")[0]
|
|
38
38
|
|
|
39
39
|
# Process all seasons
|
|
40
40
|
season_items = soup.find_all('div', class_='accordion-item')
|