Skip to content

Commit e864855

Browse files
committed
Bump v2.9.6
1 parent d0bdd8c commit e864855

File tree

24 files changed

+101
-96
lines changed

24 files changed

+101
-96
lines changed

StreamingCommunity/Api/Site/1337xx/site.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626
max_timeout = config_manager.get_int("REQUESTS", "timeout")
2727

2828

29-
def title_search(word_to_search: str) -> int:
29+
def title_search(query: str) -> int:
3030
"""
3131
Search for titles based on a search query.
3232
3333
Parameters:
34-
- title_search (str): The title to search for.
34+
- query (str): The query to search for.
3535
3636
Returns:
3737
- int: The number of titles found.
3838
"""
3939
media_search_manager.clear()
4040
table_show_manager.clear()
4141

42-
search_url = f"{site_constant.FULL_URL}/search/{word_to_search}/1/"
42+
search_url = f"{site_constant.FULL_URL}/search/{query}/1/"
4343
console.print(f"[cyan]Search url: [yellow]{search_url}")
4444

4545
try:

StreamingCommunity/Api/Site/1337xx/title.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ def download_title(select_title: MediaItem):
3333
- select_title (MediaItem): The media item to be downloaded. This should be an instance of the MediaItem class, containing attributes like `name` and `url`.
3434
"""
3535
start_message()
36-
console.print(f"[yellow]Download: [red]{select_title.name} \n")
37-
print()
38-
36+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
37+
3938
# Define output path
4039
title_name = os_manager.get_sanitize_file(select_title.name)
4140
mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))

StreamingCommunity/Api/Site/altadefinizione/film.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def download_film(select_title: MediaItem) -> str:
5656
TelegramSession.updateScriptId(script_id, select_title.name)
5757

5858
start_message()
59-
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")
6060

6161
# Extract mostraguarda link
6262
try:

StreamingCommunity/Api/Site/altadefinizione/series.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
5555

5656
# Get info about episode
5757
obj_episode = scrape_serie.seasons_manager.get_season_by_number(int(index_season_selected)).episodes.get(index_episode_selected-1)
58-
console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.name}")
59-
print()
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")
6059

6160
if site_constant.TELEGRAM_BOT:
6261
bot = get_bot_instance()

StreamingCommunity/Api/Site/altadefinizione/site.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
max_timeout = config_manager.get_int("REQUESTS", "timeout")
2727

2828

29-
def title_search(title_search: str) -> int:
29+
def title_search(query: str) -> int:
3030
"""
3131
Search for titles based on a search query.
3232
3333
Parameters:
34-
- title_search (str): The title to search for.
34+
- query (str): The query to search for.
3535
3636
Returns:
3737
int: The number of titles found.
@@ -42,7 +42,7 @@ def title_search(title_search: str) -> int:
4242
media_search_manager.clear()
4343
table_show_manager.clear()
4444

45-
search_url = f"{site_constant.FULL_URL}/?story={title_search}&do=search&subaction=search"
45+
search_url = f"{site_constant.FULL_URL}/?story={query}&do=search&subaction=search"
4646
console.print(f"[cyan]Search url: [yellow]{search_url}")
4747

4848
try:

StreamingCommunity/Api/Site/animeunity/film_serie.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
5555
if obj_episode is not None:
5656

5757
start_message()
58-
console.print(f"[yellow]Download: [red]EP_{obj_episode.number} \n")
59-
console.print("[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
58+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] ([cyan]E{obj_episode.number}[/cyan]) \n")
6059

6160
if site_constant.TELEGRAM_BOT:
6261
bot.send_message(f"Download in corso:\nTitolo:{scrape_serie.series_name}\nEpisodio: {obj_episode.number}", None)
@@ -70,7 +69,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
7069
video_source.get_embed(obj_episode.id)
7170

7271
# Create output path
73-
title_name = f"{scrape_serie.series_name}_EP_{dynamic_format_number(str(obj_episode.number))}.mp4"
72+
mp4_name = f"{scrape_serie.series_name}_EP_{dynamic_format_number(str(obj_episode.number))}.mp4"
7473

7574
if scrape_serie.is_series:
7675
mp4_path = os_manager.get_sanitize_path(os.path.join(site_constant.ANIME_FOLDER, scrape_serie.series_name))
@@ -84,7 +83,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
8483
# Start downloading
8584
path, kill_handler = MP4_downloader(
8685
url=str(video_source.src_mp4).strip(),
87-
path=os.path.join(mp4_path, title_name)
86+
path=os.path.join(mp4_path, mp4_name)
8887
)
8988

9089
return path, kill_handler

StreamingCommunity/Api/Site/animeunity/site.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ def get_real_title(record):
8383
return record['title_it']
8484

8585

86-
def title_search(title: str) -> int:
86+
def title_search(query: str) -> int:
8787
"""
88-
Function to perform an anime search using a provided title.
88+
Function to perform an anime search using a provided query.
8989
9090
Parameters:
91-
- title_search (str): The title to search for.
91+
- query (str): The query to search for.
9292
9393
Returns:
9494
- int: A number containing the length of media search manager.
@@ -106,7 +106,7 @@ def title_search(title: str) -> int:
106106
'user-agent': get_userAgent(),
107107
'x-csrf-token': data.get('csrf_token')
108108
}
109-
json_data = {'title': title}
109+
json_data = {'title': query}
110110

111111
# Send a POST request to the API endpoint for live search
112112
try:

StreamingCommunity/Api/Site/animeworld/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Variable
2020
indice = 8
2121
_useFor = "anime"
22-
_deprecate = True
22+
_deprecate = False
2323
_priority = 2
2424
_engineDownload = "mp4"
2525

StreamingCommunity/Api/Site/animeworld/serie.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Logic class
2020
from .util.ScrapeSerie import ScrapSerie
2121
from StreamingCommunity.Api.Template.config_loader import site_constant
22-
from StreamingCommunity.Api.Template.Util import manage_selection, dynamic_format_number
22+
from StreamingCommunity.Api.Template.Util import manage_selection, dynamic_format_number, map_episode_title
2323
from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
2424

2525

@@ -48,12 +48,11 @@ def download_episode(index_select: int, scrape_serie: ScrapSerie, episodes) -> T
4848
start_message()
4949

5050
# Get information about the selected episode
51-
console.print(f"[yellow]Download: [red]EP_{index_select} \n")
52-
console.print("[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
51+
console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] ([cyan]E{index_select+1}[/cyan]) \n")
5352

54-
# Create output path
55-
title_name = f"{scrape_serie.get_name()}_EP_{dynamic_format_number(str(index_select))}.mp4"
56-
mp4_path = os_manager.get_sanitize_path(os.path.join(site_constant.ANIME_FOLDER, scrape_serie.get_name()))
53+
# Define filename and path for the downloaded video
54+
mp4_name = f"{scrape_serie.get_name()}_EP_{dynamic_format_number(str(index_select+1))}.mp4"
55+
mp4_path = os.path.join(site_constant.ANIME_FOLDER, scrape_serie.get_name())
5756

5857
# Create output folder
5958
os_manager.create_path(mp4_path)
@@ -65,7 +64,7 @@ def download_episode(index_select: int, scrape_serie: ScrapSerie, episodes) -> T
6564
# Start downloading
6665
path, kill_handler = MP4_downloader(
6766
url=str(mp4_link).strip(),
68-
path=os.path.join(mp4_path, title_name)
67+
path=os.path.join(mp4_path, mp4_name)
6968
)
7069

7170
return path, kill_handler

StreamingCommunity/Api/Site/animeworld/site.py

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,45 +55,54 @@ def get_session_and_csrf() -> dict:
5555
logging.info(f"CSRF Token: {csrf_token}")
5656
return session_id, csrf_token
5757

58-
def title_search(title: str) -> int:
58+
def title_search(query: str) -> int:
5959
"""
6060
Function to perform an anime search using a provided title.
6161
6262
Parameters:
63-
- title_search (str): The title to search for.
63+
- query (str): The query to search for.
6464
6565
Returns:
6666
- int: A number containing the length of media search manager.
6767
"""
68-
session_id, csrf_token = get_session_and_csrf()
69-
url = f"{site_constant.FULL_URL}/api/search/v2"
70-
71-
# Set up the headers, params for the request
72-
headers = {
73-
'User-Agent': get_userAgent(),
74-
'Accept': 'application/json, text/javascript, */*; q=0.01',
75-
'CSRF-Token': csrf_token,
76-
'X-Requested-With': 'XMLHttpRequest'
77-
}
78-
params = {
79-
'keyword': title,
80-
}
81-
82-
# Make the POST request
83-
response = httpx.post(url, params=params, cookies={'sessionId': session_id}, headers=headers)
84-
85-
for dict_title in response.json()['animes']:
86-
try:
68+
search_url = f"{site_constant.FULL_URL}/search?keyword={query}"
69+
console.print(f"[cyan]Search url: [yellow]{search_url}")
70+
71+
# Make the GET request
72+
try:
73+
response = httpx.get(search_url, headers={'User-Agent': get_userAgent()})
74+
75+
except Exception as e:
76+
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
77+
return 0
8778

88-
media_search_manager.add_media({
89-
'id': dict_title.get('id'),
90-
'name': dict_title.get('name'),
91-
'type': 'TV',
92-
'status': dict_title.get('stateName'),
93-
'episodes_count': dict_title.get('episodes'),
94-
'plot': ' '.join((words := str(dict_title.get('story', '')).split())[:10]) + ('...' if len(words) > 10 else ''),
95-
'url': f"{site_constant.FULL_URL}/play/{dict_title.get('link')}.{dict_title.get('identifier')}"
96-
})
79+
# Create soup istance
80+
soup = BeautifulSoup(response.text, 'html.parser')
81+
82+
# Collect data from soup
83+
for element in soup.find_all('a', class_='poster'):
84+
try:
85+
title = element.find('img').get('alt')
86+
url = f"{site_constant.FULL_URL}{element.get('href')}"
87+
status_div = element.find('div', class_='status')
88+
is_dubbed = False
89+
anime_type = 'TV'
90+
91+
if status_div:
92+
if status_div.find('div', class_='dub'):
93+
is_dubbed = True
94+
95+
if status_div.find('div', class_='movie'):
96+
anime_type = 'Movie'
97+
elif status_div.find('div', class_='ona'):
98+
anime_type = 'ONA'
99+
100+
media_search_manager.add_media({
101+
'name': title,
102+
'type': anime_type,
103+
'DUB': is_dubbed,
104+
'url': url
105+
})
97106

98107
except Exception as e:
99108
print(f"Error parsing a film entry: {e}")

0 commit comments

Comments
 (0)