StreamingCommunity 2.5.6__py3-none-any.whl → 2.5.8__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/ddl.py +2 -3
- StreamingCommunity/Api/Site/1337xx/__init__.py +5 -6
- StreamingCommunity/Api/Site/1337xx/site.py +7 -14
- StreamingCommunity/Api/Site/1337xx/title.py +3 -5
- StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py +7 -6
- StreamingCommunity/Api/Site/altadefinizionegratis/film.py +14 -19
- StreamingCommunity/Api/Site/altadefinizionegratis/site.py +6 -14
- StreamingCommunity/Api/Site/animeunity/__init__.py +7 -7
- StreamingCommunity/Api/Site/animeunity/film_serie.py +29 -31
- StreamingCommunity/Api/Site/animeunity/site.py +14 -22
- StreamingCommunity/Api/Site/cb01new/__init__.py +5 -4
- StreamingCommunity/Api/Site/cb01new/film.py +2 -5
- StreamingCommunity/Api/Site/cb01new/site.py +5 -13
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +5 -4
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +12 -49
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +6 -16
- StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +2 -3
- StreamingCommunity/Api/Site/guardaserie/__init__.py +5 -4
- StreamingCommunity/Api/Site/guardaserie/series.py +12 -46
- StreamingCommunity/Api/Site/guardaserie/site.py +5 -13
- StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +10 -14
- StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +5 -4
- StreamingCommunity/Api/Site/ilcorsaronero/site.py +5 -13
- StreamingCommunity/Api/Site/ilcorsaronero/title.py +3 -5
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +2 -2
- StreamingCommunity/Api/Site/mostraguarda/film.py +4 -8
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +8 -7
- StreamingCommunity/Api/Site/streamingcommunity/film.py +14 -18
- StreamingCommunity/Api/Site/streamingcommunity/series.py +25 -76
- StreamingCommunity/Api/Site/streamingcommunity/site.py +11 -23
- StreamingCommunity/Api/Template/Util/__init__.py +8 -1
- StreamingCommunity/Api/Template/Util/manage_ep.py +46 -2
- StreamingCommunity/Api/Template/config_loader.py +71 -0
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +60 -60
- StreamingCommunity/Lib/Downloader/HLS/segments.py +40 -15
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +47 -40
- StreamingCommunity/Lib/FFmpeg/command.py +59 -3
- StreamingCommunity/Lib/M3U8/estimator.py +10 -12
- StreamingCommunity/Lib/M3U8/parser.py +12 -51
- StreamingCommunity/Lib/TMBD/tmdb.py +66 -99
- StreamingCommunity/TelegramHelp/telegram_bot.py +222 -68
- StreamingCommunity/Util/_jsonConfig.py +14 -13
- StreamingCommunity/Util/ffmpeg_installer.py +70 -64
- StreamingCommunity/Util/headers.py +11 -122
- StreamingCommunity/Util/os.py +65 -56
- StreamingCommunity/Util/table.py +62 -108
- StreamingCommunity/run.py +16 -11
- {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/METADATA +57 -23
- StreamingCommunity-2.5.8.dist-info/RECORD +86 -0
- StreamingCommunity/Api/Site/1337xx/costant.py +0 -15
- StreamingCommunity/Api/Site/altadefinizionegratis/costant.py +0 -21
- StreamingCommunity/Api/Site/animeunity/costant.py +0 -21
- StreamingCommunity/Api/Site/cb01new/costant.py +0 -19
- StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +0 -20
- StreamingCommunity/Api/Site/guardaserie/costant.py +0 -19
- StreamingCommunity/Api/Site/ilcorsaronero/costant.py +0 -19
- StreamingCommunity/Api/Site/mostraguarda/costant.py +0 -19
- StreamingCommunity/Api/Site/streamingcommunity/costant.py +0 -21
- StreamingCommunity/TelegramHelp/request_manager.py +0 -82
- StreamingCommunity/TelegramHelp/session.py +0 -56
- StreamingCommunity-2.5.6.dist-info/RECORD +0 -96
- {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/LICENSE +0 -0
- {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/WHEEL +0 -0
- {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/entry_points.txt +0 -0
- {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/top_level.txt +0 -0
|
@@ -14,17 +14,16 @@ from StreamingCommunity.Util.headers import get_headers
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
# Variable
|
|
17
|
-
from StreamingCommunity.Api.Site.ddlstreamitaly.costant import COOKIE
|
|
18
17
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
class VideoSource:
|
|
22
|
-
def __init__(self) -> None:
|
|
21
|
+
def __init__(self, cookie) -> None:
|
|
23
22
|
"""
|
|
24
23
|
Initializes the VideoSource object with default values.
|
|
25
24
|
"""
|
|
26
25
|
self.headers = {'user-agent': get_headers()}
|
|
27
|
-
self.cookie =
|
|
26
|
+
self.cookie = cookie
|
|
28
27
|
|
|
29
28
|
def setup(self, url: str) -> None:
|
|
30
29
|
"""
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# 02.07.24
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
|
-
import subprocess
|
|
5
3
|
from urllib.parse import quote_plus
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
# Internal utilities
|
|
9
7
|
from StreamingCommunity.Util.console import console, msg
|
|
8
|
+
from StreamingCommunity.Api.Template import get_select_title
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
# Logic class
|
|
13
|
-
from .
|
|
12
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
13
|
+
from .site import title_search, media_search_manager, table_show_manager
|
|
14
14
|
from .title import download_title
|
|
15
15
|
|
|
16
16
|
|
|
@@ -20,7 +20,6 @@ _useFor = "film_serie"
|
|
|
20
20
|
_deprecate = False
|
|
21
21
|
_priority = 2
|
|
22
22
|
_engineDownload = "tor"
|
|
23
|
-
from .costant import SITE_NAME
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
@@ -28,7 +27,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
28
27
|
Main function of the application for film and series.
|
|
29
28
|
"""
|
|
30
29
|
if string_to_search is None:
|
|
31
|
-
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
|
|
30
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
32
31
|
|
|
33
32
|
# Search on database
|
|
34
33
|
len_database = title_search(quote_plus(string_to_search))
|
|
@@ -40,7 +39,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
40
39
|
if len_database > 0:
|
|
41
40
|
|
|
42
41
|
# Select title from list
|
|
43
|
-
select_title =
|
|
42
|
+
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
44
43
|
|
|
45
44
|
# Download title
|
|
46
45
|
download_title(select_title)
|
|
@@ -13,13 +13,12 @@ from StreamingCommunity.Util.table import TVShowManager
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# Logic class
|
|
16
|
-
from StreamingCommunity.Api.Template import
|
|
16
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
17
17
|
from StreamingCommunity.Api.Template.Util import search_domain
|
|
18
18
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
# Variable
|
|
22
|
-
from .costant import SITE_NAME, DOMAIN_NOW
|
|
23
22
|
media_search_manager = MediaManager()
|
|
24
23
|
table_show_manager = TVShowManager()
|
|
25
24
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
@@ -40,15 +39,15 @@ def title_search(word_to_search: str) -> int:
|
|
|
40
39
|
table_show_manager.clear()
|
|
41
40
|
|
|
42
41
|
# Find new domain if prev dont work
|
|
43
|
-
domain_to_use = DOMAIN_NOW
|
|
42
|
+
domain_to_use = site_constant.DOMAIN_NOW
|
|
44
43
|
|
|
45
44
|
if not disable_searchDomain:
|
|
46
|
-
domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
|
|
45
|
+
domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
|
|
47
46
|
|
|
48
47
|
# Construct the full site URL and load the search page
|
|
49
48
|
try:
|
|
50
49
|
response = httpx.get(
|
|
51
|
-
url=f"https://{SITE_NAME}.{domain_to_use}/search/{word_to_search}/1/",
|
|
50
|
+
url=f"https://{site_constant.SITE_NAME}.{domain_to_use}/search/{word_to_search}/1/",
|
|
52
51
|
headers={'user-agent': get_headers()},
|
|
53
52
|
follow_redirects=True,
|
|
54
53
|
timeout=max_timeout
|
|
@@ -56,7 +55,7 @@ def title_search(word_to_search: str) -> int:
|
|
|
56
55
|
response.raise_for_status()
|
|
57
56
|
|
|
58
57
|
except Exception as e:
|
|
59
|
-
console.print(f"Site: {SITE_NAME}, request search error: {e}")
|
|
58
|
+
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
|
60
59
|
|
|
61
60
|
# Create soup and find table
|
|
62
61
|
soup = BeautifulSoup(response.text, "html.parser")
|
|
@@ -72,16 +71,10 @@ def title_search(word_to_search: str) -> int:
|
|
|
72
71
|
'date': tr.find_all("td")[-3].get_text(strip=True).replace("'", ""),
|
|
73
72
|
'size': tr.find_all("td")[-2].get_text(strip=True)
|
|
74
73
|
}
|
|
74
|
+
media_search_manager.add_media(title_info)
|
|
75
75
|
|
|
76
76
|
except Exception as e:
|
|
77
77
|
print(f"Error parsing a film entry: {e}")
|
|
78
78
|
|
|
79
79
|
# Return the number of titles found
|
|
80
|
-
return media_search_manager.get_length()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def run_get_select_title():
|
|
84
|
-
"""
|
|
85
|
-
Display a selection of titles and prompt the user to choose one.
|
|
86
|
-
"""
|
|
87
|
-
return get_select_title(table_show_manager, media_search_manager)
|
|
80
|
+
return media_search_manager.get_length()
|
|
@@ -17,12 +17,10 @@ from StreamingCommunity.Lib.Downloader import TOR_downloader
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
# Logic class
|
|
20
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
20
21
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
# Config
|
|
24
|
-
from .costant import DOMAIN_NOW, SITE_NAME, MOVIE_FOLDER
|
|
25
|
-
|
|
26
24
|
|
|
27
25
|
def download_title(select_title: MediaItem):
|
|
28
26
|
"""
|
|
@@ -37,13 +35,13 @@ def download_title(select_title: MediaItem):
|
|
|
37
35
|
|
|
38
36
|
# Define output path
|
|
39
37
|
title_name = os_manager.get_sanitize_file(select_title.name)
|
|
40
|
-
mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
38
|
+
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
41
39
|
|
|
42
40
|
# Create output folder
|
|
43
41
|
os_manager.create_path(mp4_path)
|
|
44
42
|
|
|
45
43
|
# Make request to page with magnet
|
|
46
|
-
full_site_name = f"{SITE_NAME}.{DOMAIN_NOW}"
|
|
44
|
+
full_site_name = f"{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}"
|
|
47
45
|
response = httpx.get(
|
|
48
46
|
url="https://" + full_site_name + select_title.url,
|
|
49
47
|
headers={
|
|
@@ -7,11 +7,13 @@ from urllib.parse import quote_plus
|
|
|
7
7
|
|
|
8
8
|
# Internal utilities
|
|
9
9
|
from StreamingCommunity.Util.console import console, msg
|
|
10
|
+
from StreamingCommunity.Api.Template import get_select_title
|
|
10
11
|
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
# Logic class
|
|
14
|
-
from .
|
|
15
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
16
|
+
from .site import title_search, media_search_manager, table_show_manager
|
|
15
17
|
from .film import download_film
|
|
16
18
|
|
|
17
19
|
|
|
@@ -21,14 +23,13 @@ _useFor = "film"
|
|
|
21
23
|
_deprecate = False
|
|
22
24
|
_priority = 2
|
|
23
25
|
_engineDownload = "hls"
|
|
24
|
-
from .costant import SITE_NAME, TELEGRAM_BOT
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
28
29
|
"""
|
|
29
30
|
Main function of the application for film and series.
|
|
30
31
|
"""
|
|
31
|
-
if TELEGRAM_BOT:
|
|
32
|
+
if site_constant.TELEGRAM_BOT:
|
|
32
33
|
bot = get_bot_instance()
|
|
33
34
|
|
|
34
35
|
if string_to_search is None:
|
|
@@ -48,7 +49,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
48
49
|
|
|
49
50
|
else:
|
|
50
51
|
if string_to_search is None:
|
|
51
|
-
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
|
|
52
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
52
53
|
|
|
53
54
|
# Search on database
|
|
54
55
|
len_database = title_search(quote_plus(string_to_search))
|
|
@@ -60,13 +61,13 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
60
61
|
if len_database > 0:
|
|
61
62
|
|
|
62
63
|
# Select title from list
|
|
63
|
-
select_title =
|
|
64
|
+
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
64
65
|
|
|
65
66
|
# Download only film
|
|
66
67
|
download_film(select_title)
|
|
67
68
|
|
|
68
69
|
else:
|
|
69
|
-
if TELEGRAM_BOT:
|
|
70
|
+
if site_constant.TELEGRAM_BOT:
|
|
70
71
|
bot.send_message(f"Nessun risultato trovato riprova", None)
|
|
71
72
|
|
|
72
73
|
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
@@ -8,11 +8,11 @@ from StreamingCommunity.Util.console import console
|
|
|
8
8
|
from StreamingCommunity.Util.os import os_manager
|
|
9
9
|
from StreamingCommunity.Util.message import start_message
|
|
10
10
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
|
11
|
-
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
12
|
-
from StreamingCommunity.TelegramHelp.session import get_session, updateScriptId, deleteScriptId
|
|
11
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
# Logic class
|
|
15
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
16
16
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
17
17
|
|
|
18
18
|
|
|
@@ -20,10 +20,6 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
|
20
20
|
from StreamingCommunity.Api.Player.supervideo import VideoSource
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
# Config
|
|
24
|
-
from .costant import MOVIE_FOLDER, TELEGRAM_BOT
|
|
25
|
-
|
|
26
|
-
|
|
27
23
|
def download_film(select_title: MediaItem) -> str:
|
|
28
24
|
"""
|
|
29
25
|
Downloads a film using the provided film ID, title name, and domain.
|
|
@@ -35,43 +31,42 @@ def download_film(select_title: MediaItem) -> str:
|
|
|
35
31
|
Return:
|
|
36
32
|
- str: output path
|
|
37
33
|
"""
|
|
38
|
-
if TELEGRAM_BOT:
|
|
34
|
+
if site_constant.TELEGRAM_BOT:
|
|
39
35
|
bot = get_bot_instance()
|
|
40
36
|
bot.send_message(f"Download in corso:\n{select_title.name}", None)
|
|
41
|
-
|
|
37
|
+
|
|
42
38
|
# Get script_id
|
|
43
|
-
script_id = get_session()
|
|
39
|
+
script_id = TelegramSession.get_session()
|
|
44
40
|
if script_id != "unknown":
|
|
45
|
-
updateScriptId(script_id, select_title.name)
|
|
41
|
+
TelegramSession.updateScriptId(script_id, select_title.name)
|
|
46
42
|
|
|
47
43
|
# Start message and display film information
|
|
48
44
|
start_message()
|
|
49
45
|
console.print(f"[yellow]Download: [red]{select_title.name} \n")
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
|
|
52
47
|
# Set domain and media ID for the video source
|
|
53
48
|
video_source = VideoSource(select_title.url)
|
|
54
49
|
|
|
55
50
|
# Define output path
|
|
56
51
|
title_name = os_manager.get_sanitize_file(select_title.name) + ".mp4"
|
|
57
|
-
mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
52
|
+
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
|
|
58
53
|
|
|
59
54
|
# Get m3u8 master playlist
|
|
60
55
|
master_playlist = video_source.get_playlist()
|
|
61
56
|
|
|
62
57
|
# Download the film using the m3u8 playlist, and output filename
|
|
63
58
|
r_proc = HLS_Downloader(
|
|
64
|
-
m3u8_url=master_playlist,
|
|
59
|
+
m3u8_url=master_playlist,
|
|
65
60
|
output_path=os.path.join(mp4_path, title_name)
|
|
66
61
|
).start()
|
|
67
62
|
|
|
68
|
-
if TELEGRAM_BOT:
|
|
69
|
-
|
|
63
|
+
if site_constant.TELEGRAM_BOT:
|
|
64
|
+
|
|
70
65
|
# Delete script_id
|
|
71
|
-
script_id = get_session()
|
|
66
|
+
script_id = TelegramSession.get_session()
|
|
72
67
|
if script_id != "unknown":
|
|
73
|
-
deleteScriptId(script_id)
|
|
74
|
-
|
|
68
|
+
TelegramSession.deleteScriptId(script_id)
|
|
69
|
+
|
|
75
70
|
if "error" in r_proc.keys():
|
|
76
71
|
try:
|
|
77
72
|
os.remove(r_proc['path'])
|
|
@@ -13,13 +13,12 @@ from StreamingCommunity.Util.table import TVShowManager
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# Logic class
|
|
16
|
-
from StreamingCommunity.Api.Template import
|
|
16
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
17
17
|
from StreamingCommunity.Api.Template.Util import search_domain
|
|
18
18
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
# Variable
|
|
22
|
-
from .costant import SITE_NAME, DOMAIN_NOW
|
|
23
22
|
media_search_manager = MediaManager()
|
|
24
23
|
table_show_manager = TVShowManager()
|
|
25
24
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
@@ -48,24 +47,24 @@ def title_search(title_search: str) -> int:
|
|
|
48
47
|
table_show_manager.clear()
|
|
49
48
|
|
|
50
49
|
# Find new domain if prev dont work
|
|
51
|
-
domain_to_use = DOMAIN_NOW
|
|
50
|
+
domain_to_use = site_constant.DOMAIN_NOW
|
|
52
51
|
|
|
53
52
|
if not disable_searchDomain:
|
|
54
|
-
domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
|
|
53
|
+
domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
|
|
55
54
|
|
|
56
55
|
# Send request to search for title
|
|
57
56
|
client = httpx.Client()
|
|
58
57
|
|
|
59
58
|
try:
|
|
60
59
|
response = client.get(
|
|
61
|
-
url=f"https://{SITE_NAME}.{domain_to_use}/?story={title_search.replace(' ', '+')}&do=search&subaction=search&titleonly=3",
|
|
60
|
+
url=f"https://{site_constant.SITE_NAME}.{domain_to_use}/?story={title_search.replace(' ', '+')}&do=search&subaction=search&titleonly=3",
|
|
62
61
|
headers={'User-Agent': get_headers()},
|
|
63
62
|
timeout=max_timeout
|
|
64
63
|
)
|
|
65
64
|
response.raise_for_status()
|
|
66
65
|
|
|
67
66
|
except Exception as e:
|
|
68
|
-
console.print(f"Site: {SITE_NAME}, request search error: {e}")
|
|
67
|
+
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
|
69
68
|
raise
|
|
70
69
|
|
|
71
70
|
# Create soup and find table
|
|
@@ -107,11 +106,4 @@ def title_search(title_search: str) -> int:
|
|
|
107
106
|
bot.send_message(f"Lista dei risultati:", choices)
|
|
108
107
|
|
|
109
108
|
# Return the number of titles found
|
|
110
|
-
return media_search_manager.get_length()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def run_get_select_title():
|
|
114
|
-
"""
|
|
115
|
-
Display a selection of titles and prompt the user to choose one.
|
|
116
|
-
"""
|
|
117
|
-
return get_select_title(table_show_manager, media_search_manager)
|
|
109
|
+
return media_search_manager.get_length()
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import subprocess
|
|
5
|
-
from urllib.parse import quote_plus
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
# Internal utilities
|
|
9
8
|
from StreamingCommunity.Util.console import console, msg
|
|
9
|
+
from StreamingCommunity.Api.Template import get_select_title
|
|
10
10
|
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
# Logic class
|
|
14
|
-
from .
|
|
14
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
15
|
+
from .site import title_search, media_search_manager, table_show_manager
|
|
15
16
|
from .film_serie import download_film, download_series
|
|
16
17
|
|
|
17
18
|
|
|
@@ -21,12 +22,11 @@ _useFor = "anime"
|
|
|
21
22
|
_deprecate = False
|
|
22
23
|
_priority = 2
|
|
23
24
|
_engineDownload = "mp4"
|
|
24
|
-
from .costant import SITE_NAME, TELEGRAM_BOT
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
28
28
|
|
|
29
|
-
if TELEGRAM_BOT:
|
|
29
|
+
if site_constant.TELEGRAM_BOT:
|
|
30
30
|
bot = get_bot_instance()
|
|
31
31
|
|
|
32
32
|
if string_to_search is None:
|
|
@@ -46,7 +46,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
46
46
|
|
|
47
47
|
else:
|
|
48
48
|
if string_to_search is None:
|
|
49
|
-
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
|
|
49
|
+
string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
|
|
50
50
|
|
|
51
51
|
# Search on database
|
|
52
52
|
len_database = title_search(string_to_search)
|
|
@@ -58,7 +58,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
58
58
|
if len_database > 0:
|
|
59
59
|
|
|
60
60
|
# Select title from list (type: TV \ Movie \ OVA)
|
|
61
|
-
select_title =
|
|
61
|
+
select_title = get_select_title(table_show_manager, media_search_manager)
|
|
62
62
|
|
|
63
63
|
if select_title.type == 'Movie' or select_title.type == 'OVA':
|
|
64
64
|
download_film(select_title)
|
|
@@ -67,7 +67,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
|
|
|
67
67
|
download_series(select_title)
|
|
68
68
|
|
|
69
69
|
else:
|
|
70
|
-
if TELEGRAM_BOT:
|
|
70
|
+
if site_constant.TELEGRAM_BOT:
|
|
71
71
|
bot.send_message(f"Nessun risultato trovato riprova", None)
|
|
72
72
|
|
|
73
73
|
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
|
|
@@ -10,13 +10,13 @@ from StreamingCommunity.Util.console import console, msg
|
|
|
10
10
|
from StreamingCommunity.Util.os import os_manager
|
|
11
11
|
from StreamingCommunity.Util.message import start_message
|
|
12
12
|
from StreamingCommunity.Lib.Downloader import MP4_downloader
|
|
13
|
-
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
14
|
-
from StreamingCommunity.TelegramHelp.session import get_session, updateScriptId, deleteScriptId
|
|
13
|
+
from StreamingCommunity.TelegramHelp.telegram_bot import TelegramSession, get_bot_instance
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
# Logic class
|
|
18
17
|
from .util.ScrapeSerie import ScrapeSerieAnime
|
|
19
|
-
from StreamingCommunity.Api.Template.
|
|
18
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
19
|
+
from StreamingCommunity.Api.Template.Util import manage_selection, dynamic_format_number
|
|
20
20
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
|
|
21
21
|
|
|
22
22
|
|
|
@@ -25,7 +25,6 @@ from StreamingCommunity.Api.Player.vixcloud import VideoSourceAnime
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
# Variable
|
|
28
|
-
from .costant import SITE_NAME, ANIME_FOLDER, MOVIE_FOLDER, TELEGRAM_BOT
|
|
29
28
|
KILL_HANDLER = bool(False)
|
|
30
29
|
|
|
31
30
|
|
|
@@ -41,9 +40,9 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
|
|
|
41
40
|
- str: output path
|
|
42
41
|
- bool: kill handler status
|
|
43
42
|
"""
|
|
44
|
-
if TELEGRAM_BOT:
|
|
43
|
+
if site_constant.TELEGRAM_BOT:
|
|
45
44
|
bot = get_bot_instance()
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
# Get information about the selected episode
|
|
48
47
|
obj_episode = scrape_serie.get_info_episode(index_select)
|
|
49
48
|
|
|
@@ -52,38 +51,37 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
|
|
|
52
51
|
start_message()
|
|
53
52
|
console.print(f"[yellow]Download: [red]EP_{obj_episode.number} \n")
|
|
54
53
|
console.print("[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
|
|
55
|
-
|
|
56
|
-
if TELEGRAM_BOT:
|
|
54
|
+
|
|
55
|
+
if site_constant.TELEGRAM_BOT:
|
|
57
56
|
bot.send_message(f"Download in corso:\nTitolo:{scrape_serie.series_name}\nEpisodio: {obj_episode.number}", None)
|
|
58
57
|
|
|
59
58
|
# Get script_id
|
|
60
|
-
script_id = get_session()
|
|
59
|
+
script_id = TelegramSession.get_session()
|
|
61
60
|
if script_id != "unknown":
|
|
62
|
-
updateScriptId(script_id, f"{scrape_serie.series_name} - E{obj_episode.number}")
|
|
61
|
+
TelegramSession.updateScriptId(script_id, f"{scrape_serie.series_name} - E{obj_episode.number}")
|
|
63
62
|
|
|
64
63
|
# Collect mp4 url
|
|
65
64
|
video_source.get_embed(obj_episode.id)
|
|
66
65
|
|
|
67
66
|
# Create output path
|
|
68
|
-
title_name = f"{obj_episode.number}.mp4"
|
|
69
|
-
title_name = f"{scrape_serie.series_name}_EP_{obj_episode.number}.mp4"
|
|
67
|
+
title_name = f"{scrape_serie.series_name}_EP_{dynamic_format_number(int(obj_episode.number))}.mp4"
|
|
70
68
|
|
|
71
69
|
if scrape_serie.is_series:
|
|
72
|
-
mp4_path = os_manager.get_sanitize_path(os.path.join(ANIME_FOLDER, scrape_serie.series_name))
|
|
70
|
+
mp4_path = os_manager.get_sanitize_path(os.path.join(site_constant.ANIME_FOLDER, scrape_serie.series_name))
|
|
73
71
|
|
|
74
72
|
else:
|
|
75
|
-
mp4_path = os_manager.get_sanitize_path(os.path.join(MOVIE_FOLDER, scrape_serie.series_name))
|
|
73
|
+
mp4_path = os_manager.get_sanitize_path(os.path.join(site_constant.MOVIE_FOLDER, scrape_serie.series_name))
|
|
76
74
|
|
|
77
75
|
# Create output folder
|
|
78
|
-
os_manager.create_path(mp4_path)
|
|
76
|
+
os_manager.create_path(mp4_path)
|
|
79
77
|
|
|
80
78
|
# Start downloading
|
|
81
79
|
path, kill_handler = MP4_downloader(
|
|
82
80
|
url=str(video_source.src_mp4).strip(),
|
|
83
81
|
path=os.path.join(mp4_path, title_name)
|
|
84
82
|
)
|
|
85
|
-
|
|
86
|
-
return path, kill_handler
|
|
83
|
+
|
|
84
|
+
return path, kill_handler
|
|
87
85
|
|
|
88
86
|
else:
|
|
89
87
|
logging.error(f"Skip index: {index_select} cant find info with api.")
|
|
@@ -98,12 +96,12 @@ def download_series(select_title: MediaItem):
|
|
|
98
96
|
- tv_name (str): The name of the TV series.
|
|
99
97
|
"""
|
|
100
98
|
start_message()
|
|
101
|
-
|
|
102
|
-
if TELEGRAM_BOT:
|
|
99
|
+
|
|
100
|
+
if site_constant.TELEGRAM_BOT:
|
|
103
101
|
bot = get_bot_instance()
|
|
104
102
|
|
|
105
|
-
scrape_serie = ScrapeSerieAnime(SITE_NAME)
|
|
106
|
-
video_source = VideoSourceAnime(SITE_NAME)
|
|
103
|
+
scrape_serie = ScrapeSerieAnime(site_constant.SITE_NAME)
|
|
104
|
+
video_source = VideoSourceAnime(site_constant.SITE_NAME)
|
|
107
105
|
|
|
108
106
|
# Set up video source
|
|
109
107
|
scrape_serie.setup(None, select_title.id, select_title.slug)
|
|
@@ -112,7 +110,7 @@ def download_series(select_title: MediaItem):
|
|
|
112
110
|
episoded_count = scrape_serie.get_count_episodes()
|
|
113
111
|
console.print(f"[cyan]Episodes find: [red]{episoded_count}")
|
|
114
112
|
|
|
115
|
-
if TELEGRAM_BOT:
|
|
113
|
+
if site_constant.TELEGRAM_BOT:
|
|
116
114
|
console.print(f"\n[cyan]Insert media [red]index [yellow]or [red](*) [cyan]to download all media [yellow]or [red][1-2] [cyan]or [red][3-*] [cyan]for a range of media")
|
|
117
115
|
bot.send_message(f"Episodi trovati: {episoded_count}", None)
|
|
118
116
|
|
|
@@ -123,9 +121,9 @@ def download_series(select_title: MediaItem):
|
|
|
123
121
|
)
|
|
124
122
|
|
|
125
123
|
else:
|
|
126
|
-
|
|
124
|
+
|
|
127
125
|
# Prompt user to select an episode index
|
|
128
|
-
last_command = msg.ask("\n[cyan]Insert media [red]index [yellow]or [red](*) [cyan]to download all media [yellow]or [red][1-2] [cyan]or [red][3-*] [cyan]for a range of media")
|
|
126
|
+
last_command = msg.ask("\n[cyan]Insert media [red]index [yellow]or [red](*) [cyan]to download all media [yellow]or [red][1-2] [cyan]or [red][3-*] [cyan]for a range of media")
|
|
129
127
|
|
|
130
128
|
# Manage user selection
|
|
131
129
|
list_episode_select = manage_selection(last_command, episoded_count)
|
|
@@ -140,16 +138,16 @@ def download_series(select_title: MediaItem):
|
|
|
140
138
|
kill_handler = False
|
|
141
139
|
for i_episode in list_episode_select:
|
|
142
140
|
if kill_handler:
|
|
143
|
-
break
|
|
141
|
+
break
|
|
144
142
|
_, kill_handler = download_episode(i_episode-1, scrape_serie, video_source)
|
|
145
|
-
|
|
146
|
-
if TELEGRAM_BOT:
|
|
143
|
+
|
|
144
|
+
if site_constant.TELEGRAM_BOT:
|
|
147
145
|
bot.send_message(f"Finito di scaricare tutte le serie e episodi", None)
|
|
148
146
|
|
|
149
147
|
# Get script_id
|
|
150
|
-
script_id = get_session()
|
|
148
|
+
script_id = TelegramSession.get_session()
|
|
151
149
|
if script_id != "unknown":
|
|
152
|
-
deleteScriptId(script_id)
|
|
150
|
+
TelegramSession.deleteScriptId(script_id)
|
|
153
151
|
|
|
154
152
|
|
|
155
153
|
def download_film(select_title: MediaItem):
|
|
@@ -162,8 +160,8 @@ def download_film(select_title: MediaItem):
|
|
|
162
160
|
"""
|
|
163
161
|
|
|
164
162
|
# Init class
|
|
165
|
-
scrape_serie = ScrapeSerieAnime(SITE_NAME)
|
|
166
|
-
video_source = VideoSourceAnime(SITE_NAME)
|
|
163
|
+
scrape_serie = ScrapeSerieAnime(site_constant.SITE_NAME)
|
|
164
|
+
video_source = VideoSourceAnime(site_constant.SITE_NAME)
|
|
167
165
|
|
|
168
166
|
# Set up video source
|
|
169
167
|
scrape_serie.setup(None, select_title.id, select_title.slug)
|
|
@@ -16,13 +16,12 @@ from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
# Logic class
|
|
19
|
-
from StreamingCommunity.Api.Template import
|
|
19
|
+
from StreamingCommunity.Api.Template.config_loader import site_constant
|
|
20
20
|
from StreamingCommunity.Api.Template.Util import search_domain
|
|
21
21
|
from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
# Variable
|
|
25
|
-
from .costant import SITE_NAME, DOMAIN_NOW, TELEGRAM_BOT
|
|
26
25
|
media_search_manager = MediaManager()
|
|
27
26
|
table_show_manager = TVShowManager()
|
|
28
27
|
max_timeout = config_manager.get_int("REQUESTS", "timeout")
|
|
@@ -104,19 +103,19 @@ def title_search(title: str) -> int:
|
|
|
104
103
|
Returns:
|
|
105
104
|
- int: A number containing the length of media search manager.
|
|
106
105
|
"""
|
|
107
|
-
if TELEGRAM_BOT:
|
|
106
|
+
if site_constant.TELEGRAM_BOT:
|
|
108
107
|
bot = get_bot_instance()
|
|
109
108
|
|
|
110
109
|
media_search_manager.clear()
|
|
111
110
|
table_show_manager.clear()
|
|
112
111
|
|
|
113
112
|
# Get token and session value from configuration
|
|
114
|
-
domain_to_use = DOMAIN_NOW
|
|
113
|
+
domain_to_use = site_constant.DOMAIN_NOW
|
|
115
114
|
|
|
116
115
|
if not disable_searchDomain:
|
|
117
|
-
domain_to_use, base_url = search_domain(SITE_NAME, f"https://www.{SITE_NAME}.{DOMAIN_NOW}")
|
|
116
|
+
domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://www.{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
|
|
118
117
|
|
|
119
|
-
data = get_token(SITE_NAME, domain_to_use)
|
|
118
|
+
data = get_token(site_constant.SITE_NAME, domain_to_use)
|
|
120
119
|
|
|
121
120
|
# Prepare cookies to be used in the request
|
|
122
121
|
cookies = {
|
|
@@ -139,7 +138,7 @@ def title_search(title: str) -> int:
|
|
|
139
138
|
# Send a POST request to the API endpoint for live search
|
|
140
139
|
try:
|
|
141
140
|
response = httpx.post(
|
|
142
|
-
url=f'https://www.{SITE_NAME}.{domain_to_use}/livesearch',
|
|
141
|
+
url=f'https://www.{site_constant.SITE_NAME}.{domain_to_use}/livesearch',
|
|
143
142
|
cookies=cookies,
|
|
144
143
|
headers=headers,
|
|
145
144
|
json=json_data,
|
|
@@ -148,10 +147,10 @@ def title_search(title: str) -> int:
|
|
|
148
147
|
response.raise_for_status()
|
|
149
148
|
|
|
150
149
|
except Exception as e:
|
|
151
|
-
console.print(f"Site: {SITE_NAME}, request search error: {e}")
|
|
150
|
+
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
|
152
151
|
|
|
153
152
|
# Inizializza la lista delle scelte
|
|
154
|
-
if TELEGRAM_BOT:
|
|
153
|
+
if site_constant.TELEGRAM_BOT:
|
|
155
154
|
choices = []
|
|
156
155
|
|
|
157
156
|
for dict_title in response.json()['records']:
|
|
@@ -169,24 +168,17 @@ def title_search(title: str) -> int:
|
|
|
169
168
|
'episodes_count': dict_title.get('episodes_count')
|
|
170
169
|
})
|
|
171
170
|
|
|
172
|
-
if TELEGRAM_BOT:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
if site_constant.TELEGRAM_BOT:
|
|
172
|
+
# Crea una stringa formattata per ogni scelta con numero
|
|
173
|
+
choice_text = f"{len(choices)} - {dict_title.get('name')} ({dict_title.get('type')}) - Episodi: {dict_title.get('episodes_count')}"
|
|
174
|
+
choices.append(choice_text)
|
|
176
175
|
|
|
177
176
|
except Exception as e:
|
|
178
177
|
print(f"Error parsing a film entry: {e}")
|
|
179
178
|
|
|
180
|
-
if TELEGRAM_BOT:
|
|
179
|
+
if site_constant.TELEGRAM_BOT:
|
|
181
180
|
if choices:
|
|
182
181
|
bot.send_message(f"Lista dei risultati:", choices)
|
|
183
182
|
|
|
184
183
|
# Return the length of media search manager
|
|
185
|
-
return media_search_manager.get_length()
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def run_get_select_title():
|
|
189
|
-
"""
|
|
190
|
-
Display a selection of titles and prompt the user to choose one.
|
|
191
|
-
"""
|
|
192
|
-
return get_select_title(table_show_manager, media_search_manager)
|
|
184
|
+
return media_search_manager.get_length()
|