mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 20:15:24 +00:00
Remove retry.
This commit is contained in:
parent
7b37a9ee71
commit
4b88da9e1c
5
Makefile
5
Makefile
@ -1,5 +0,0 @@
|
|||||||
build-container:
|
|
||||||
docker build -t streaming-community-api .
|
|
||||||
|
|
||||||
run-container:
|
|
||||||
docker run --rm -it -p 8000:8000 -v ${LOCAL_DIR}:/app/Video -v ./config.json:/app/config.json streaming-community-api
|
|
15
README.md
15
README.md
@ -29,8 +29,6 @@ Make sure you have the following prerequisites installed on your system:
|
|||||||
* [ffmpeg](https://www.gyan.dev/ffmpeg/builds/)
|
* [ffmpeg](https://www.gyan.dev/ffmpeg/builds/)
|
||||||
* [opnessl](https://www.openssl.org) or [pycryptodome](https://pypi.org/project/pycryptodome/)
|
* [opnessl](https://www.openssl.org) or [pycryptodome](https://pypi.org/project/pycryptodome/)
|
||||||
|
|
||||||
* [nodejs](https://nodejs.org/)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install the required Python libraries using the following command:
|
Install the required Python libraries using the following command:
|
||||||
@ -208,19 +206,6 @@ By default the videos will be saved in `/app/Video` inside the container, if you
|
|||||||
docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api
|
docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker quick setup with Make
|
|
||||||
|
|
||||||
Inside the Makefile (install `make`) are already configured two commands to build and run the container:
|
|
||||||
|
|
||||||
```
|
|
||||||
make build-container
|
|
||||||
|
|
||||||
# set your download directory as ENV variable
|
|
||||||
make LOCAL_DIR=/path/to/download run-container
|
|
||||||
```
|
|
||||||
|
|
||||||
The `run-container` command mounts also the `config.json` file, so any change to the configuration file is reflected immediately without having to rebuild the image.
|
|
||||||
|
|
||||||
## Tutorial
|
## Tutorial
|
||||||
|
|
||||||
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
||||||
|
@ -44,7 +44,6 @@ class GetSerieInfo:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
# Make an HTTP request to the series URL
|
# Make an HTTP request to the series URL
|
||||||
print(self.url)
|
|
||||||
response = httpx.get(self.url, headers=self.headers, timeout=10)
|
response = httpx.get(self.url, headers=self.headers, timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay')
|
|||||||
TQDM_USE_LARGE_BAR = config_manager.get_int('M3U8_DOWNLOAD', 'tqdm_use_large_bar')
|
TQDM_USE_LARGE_BAR = config_manager.get_int('M3U8_DOWNLOAD', 'tqdm_use_large_bar')
|
||||||
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
||||||
REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry')
|
REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry')
|
||||||
|
REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify_ssl')
|
||||||
THERE_IS_PROXY_LIST = check_file_existence("list_proxy.txt")
|
THERE_IS_PROXY_LIST = check_file_existence("list_proxy.txt")
|
||||||
PROXY_START_MIN = config_manager.get_float('REQUESTS', 'proxy_start_min')
|
PROXY_START_MIN = config_manager.get_float('REQUESTS', 'proxy_start_min')
|
||||||
PROXY_START_MAX = config_manager.get_float('REQUESTS', 'proxy_start_max')
|
PROXY_START_MAX = config_manager.get_float('REQUESTS', 'proxy_start_max')
|
||||||
@ -53,7 +54,6 @@ PROXY_START_MAX = config_manager.get_float('REQUESTS', 'proxy_start_max')
|
|||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
headers_index = config_manager.get_dict('REQUESTS', 'index')
|
headers_index = config_manager.get_dict('REQUESTS', 'index')
|
||||||
transport = httpx.HTTPTransport(retries=REQUEST_MAX_RETRY)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class M3U8_Segments:
|
|||||||
|
|
||||||
# Proxy
|
# Proxy
|
||||||
if THERE_IS_PROXY_LIST:
|
if THERE_IS_PROXY_LIST:
|
||||||
console.log("[red]Validate proxy.")
|
console.log("[red]Start validation proxy.")
|
||||||
self.valid_proxy = main_test_proxy(self.segments[0])
|
self.valid_proxy = main_test_proxy(self.segments[0])
|
||||||
console.log(f"[cyan]N. Valid ip: [red]{len(self.valid_proxy)}")
|
console.log(f"[cyan]N. Valid ip: [red]{len(self.valid_proxy)}")
|
||||||
|
|
||||||
@ -204,16 +204,15 @@ class M3U8_Segments:
|
|||||||
if THERE_IS_PROXY_LIST:
|
if THERE_IS_PROXY_LIST:
|
||||||
proxy = self.valid_proxy[index % len(self.valid_proxy)]
|
proxy = self.valid_proxy[index % len(self.valid_proxy)]
|
||||||
logging.info(f"Use proxy: {proxy}")
|
logging.info(f"Use proxy: {proxy}")
|
||||||
#print(client.get("https://api.ipify.org/?format=json").json())
|
|
||||||
|
|
||||||
with httpx.Client(proxies=proxy, verify=False, transport=transport) as client:
|
with httpx.Client(proxies=proxy, verify=REQUEST_VERIFY) as client:
|
||||||
if 'key_base_url' in self.__dict__:
|
if 'key_base_url' in self.__dict__:
|
||||||
response = client.get(ts_url, headers=random_headers(self.key_base_url), timeout=REQUEST_TIMEOUT)
|
response = client.get(ts_url, headers=random_headers(self.key_base_url), timeout=REQUEST_TIMEOUT)
|
||||||
else:
|
else:
|
||||||
response = client.get(ts_url, headers={'user-agent': get_headers()}, timeout=REQUEST_TIMEOUT)
|
response = client.get(ts_url, headers={'user-agent': get_headers()}, timeout=REQUEST_TIMEOUT)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
with httpx.Client(verify=False, transport=transport) as client_2:
|
with httpx.Client(verify=REQUEST_VERIFY) as client_2:
|
||||||
if 'key_base_url' in self.__dict__:
|
if 'key_base_url' in self.__dict__:
|
||||||
response = client_2.get(ts_url, headers=random_headers(self.key_base_url), timeout=REQUEST_TIMEOUT)
|
response = client_2.get(ts_url, headers=random_headers(self.key_base_url), timeout=REQUEST_TIMEOUT)
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
__title__ = 'StreamingCommunity'
|
__title__ = 'StreamingCommunity'
|
||||||
__version__ = 'v1.2.0'
|
__version__ = 'v1.1.0'
|
||||||
__author__ = 'Lovi-0'
|
__author__ = 'Lovi-0'
|
||||||
__description__ = 'A command-line program to download film'
|
__description__ = 'A command-line program to download film'
|
||||||
__copyright__ = 'Copyright 2024'
|
__copyright__ = 'Copyright 2024'
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
"not_close": false
|
"not_close": false
|
||||||
},
|
},
|
||||||
"REQUESTS": {
|
"REQUESTS": {
|
||||||
"timeout": 5,
|
"timeout": 10,
|
||||||
"max_retry": 3,
|
"max_retry": 3,
|
||||||
"verify_ssl": false,
|
"verify_ssl": true,
|
||||||
"index": {
|
"index": {
|
||||||
"user-agent": ""
|
"user-agent": ""
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
ENV TEMP /tmp
|
ENV TEMP /tmp
|
||||||
RUN mkdir -p $TEMP
|
RUN mkdir -p $TEMP
|
||||||
|
|
||||||
@ -10,11 +13,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libffi-dev \
|
libffi-dev \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
libxslt1-dev \
|
libxslt1-dev
|
||||||
nodejs
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
2
run.py
2
run.py
@ -149,7 +149,7 @@ def main():
|
|||||||
|
|
||||||
# Create dynamic prompt message and choices
|
# Create dynamic prompt message and choices
|
||||||
choice_labels = {str(i): alias.split("_")[0].capitalize() for i, alias in enumerate(search_functions.keys())}
|
choice_labels = {str(i): alias.split("_")[0].capitalize() for i, alias in enumerate(search_functions.keys())}
|
||||||
prompt_message = f"Insert category [white]({', '.join([f'[red]{key}: [magenta]{label}' for key, label in choice_labels.items()])}[white]): "
|
prompt_message = f"[green]Insert category [white]({', '.join([f'[red]{key}: [magenta]{label}' for key, label in choice_labels.items()])}[white]): "
|
||||||
|
|
||||||
# Ask the user for input
|
# Ask the user for input
|
||||||
category = msg.ask(prompt_message, choices=list(choice_labels.keys()), default="0")
|
category = msg.ask(prompt_message, choices=list(choice_labels.keys()), default="0")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user