Sky-NiniKo / anime-sama_downloader

Download video from anime-sama.fr
GNU General Public License v3.0
6 stars 2 forks source link

IF YOU WANT TO GET STREAMING LINKS INSTEAD OF DOWNLOAD : #5

Closed MysticSaba-max closed 5 days ago

MysticSaba-max commented 5 days ago

replace main.py by : import asyncio

from termcolor import colored

import config import downloader import internal_player from utils import safe_input, select_one, select_range, put_color, keyboard_inter from anime_sama import AnimeSama

async def main(): catalogues = await AnimeSama(config.URL).search( safe_input("Anime name: " + put_color("blue"), str) ) catalogue = select_one(catalogues)

seasons = await catalogue.seasons()
season = select_one(seasons)

episodes = await season.episodes()
print(
    colored(
        f"\n{season.serie_name} - {season.name}",
        "cyan",
        attrs=["bold", "underline"],
    )
)
selected_episodes = select_range(
    episodes, msg="Choose episode(s)", print_choices=True
)

for episode in selected_episodes:
    episode.languages.prefer_languages = config.PREFER_LANGUAGES
    episode.languages.set_best(config.PLAYERS["prefer"], config.PLAYERS["ban"])

    # Display available streaming links
    print(f"\nStreaming links for {colored(episode.name, 'cyan')}:")
    for lang, players in episode.languages.players.items():
        print(f"\n{colored(lang.upper(), 'yellow')}:")
        for link in players.availables:
            print(f"  • {colored('Link', 'green')}: {link}")

# Comment out the download and player section as we're just showing links
# if config.DOWNLOAD:
#     downloader.multi_download(
#         selected_episodes, config.DOWNLOAD_PATH, config.CONCURRENT_DOWNLOADS
#     )
# else:
#     internal_player.play_episode(selected_episodes[0]).wait()

if name == "main": try: asyncio.run(main()) except (KeyboardInterrupt, asyncio.exceptions.CancelledError, EOFError): keyboard_inter()

or git clone https://github.com/MysticSaba-max/anime-sama_get-episode-links

Sky-NiniKo commented 5 days ago

The goal of this project is to go from content (an episode) to the use of the content (downloading or watching). So the link shouldn't be shown. But if you explain, your use case, I may see your point.

Also if you want to suggest a code change, use a PR. You can do so by clicking on the link on the top of your repository and clicking on the green button.

MysticSaba-max commented 4 days ago

Oh okay I didn't know about that

Sky-NiniKo commented 4 days ago

Do you want to open the links in a browser or use another downloader? I am a bit curious. I've never considered using links directly, but maybe you're thinking of something I haven't thought of.

PS: If my previous message changes your mind about the usefulness of this.. Just respond "no, it's good like that" or something around those lines.