diff --git a/README.md b/README.md index efafa25..a616852 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ You can chat, help improve this repo, or just hang around for some fun in the ** * [Requirement](#requirement) * [Usage](#usage) * [Update](#update) -* [USAGE AND OPTIONS](#options) +* [CONFIGURATION](#Configuration) +* [DOCKER](#docker) * [TUTORIAL](#tutorial) ## Requirement @@ -187,5 +188,23 @@ You can choose different vars: * `%(episode_name)` : Is the name of the episode >NOTE: You don't need to add .mp4 at the end +## Docker +You can run the script in a docker container, to build the image just run +``` +docker build -t streaming-community-api . +``` + +and to run it use + +``` +docker run -it -p 8000:8000 streaming-community-api +``` + +By default the videos will be saved in `/app/Video` inside the container, if you want to to save them in your machine instead of the container just run + +``` +docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api +``` + ## Tutorial For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing) diff --git a/Src/Api/site.py b/Src/Api/site.py index 27caa96..c864fca 100644 --- a/Src/Api/site.py +++ b/Src/Api/site.py @@ -143,8 +143,8 @@ def test_site(domain: str) -> str: str: The response text if successful, otherwise None. """ - console.print("[cyan]Make request site [white]...") site_url = f"https://streamingcommunity.{domain}" + console.print(f"[cyan]Make request site to {site_url} [white]...") try: response = requests.get(site_url, headers={'user-agent': get_headers()}) diff --git a/config.json b/config.json index cdf3417..99bf9ab 100644 --- a/config.json +++ b/config.json @@ -16,7 +16,7 @@ }, "SITE": { "streaming_site_name": "streamingcommunity", - "streaming_domain": "forum", + "streaming_domain": "africa", "anime_site_name": "animeunity", "anime_domain": "to" }, diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..ff5a582 --- /dev/null +++ b/dockerfile @@ -0,0 +1,20 @@ +FROM python:3.11-slim + +COPY . /app +WORKDIR /app + +ENV TEMP /tmp +RUN mkdir -p $TEMP + +RUN apt-get update && apt-get install -y \ + ffmpeg \ + build-essential \ + libssl-dev \ + libffi-dev \ + python3-dev \ + libxml2-dev \ + libxslt1-dev + +RUN pip install --no-cache-dir -r requirements.txt + +CMD ["python", "run.py"] diff --git a/requirements.txt b/requirements.txt index de6588c..9b91b07 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/run.py b/run.py index 6dfc76e..c8311ae 100644 --- a/run.py +++ b/run.py @@ -3,6 +3,7 @@ import sys import logging import platform +import argparse # Internal utilities @@ -168,21 +169,34 @@ def main_switch(): else: console.print("[red]Cant find a single element") +def run_function(func, close_console=False): + if close_console: + while 1: + func() + else: + func() + if __name__ == '__main__': - logger = Logger() - if not SWITCH_TO: - if not CLOSE_CONSOLE: - main() - else: - while 1: - main() + # Parse command line arguments + parser = argparse.ArgumentParser(description='Script to download film and series from internet.') + parser.add_argument('-a', '--anime', action='store_true', help='Check into anime category') + parser.add_argument('-f', '--film', action='store_true', help='Check into film/tv series category') + args = parser.parse_args() + if args.anime: + run_function(main_switch, CLOSE_CONSOLE) + elif args.film: + run_function(main, CLOSE_CONSOLE) else: - if not CLOSE_CONSOLE: - main_switch() + # If no arguments are provided, ask the user to input the category + category = input("Insert category (0: Film/series, 1: Anime) : ") + if category == '0': + run_function(main, CLOSE_CONSOLE) + elif category == '1': + run_function(main_switch, CLOSE_CONSOLE) else: - while 1: - main_switch() + console.print("[red]Invalid category") + sys.exit(0) \ No newline at end of file