mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-03 10:00:10 +00:00
api: Add search verify=False
This commit is contained in:
parent
57cc01b6bc
commit
0a03be0fae
@ -22,8 +22,7 @@ from .title import download_title
|
||||
# Variable
|
||||
indice = 3
|
||||
_useFor = "film_serie"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "tor"
|
||||
|
||||
console = Console()
|
||||
|
@ -43,7 +43,12 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -25,8 +25,7 @@ from .series import download_series
|
||||
# Variable
|
||||
indice = 2
|
||||
_useFor = "film_serie"
|
||||
_deprecate = False
|
||||
_priority = 1
|
||||
_priority = 0
|
||||
_engineDownload = "hls"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -46,7 +46,12 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.post(search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.post(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -25,8 +25,7 @@ from .serie import download_series
|
||||
# Variable
|
||||
indice = 1
|
||||
_useFor = "anime"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "mp4"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -20,8 +20,7 @@ from .film import download_film
|
||||
# Variable
|
||||
indice = 8
|
||||
_useFor = "anime"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "mp4"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -70,7 +70,12 @@ def title_search(query: str) -> int:
|
||||
|
||||
# Make the GET request
|
||||
try:
|
||||
response = httpx.get(search_url, headers={'User-Agent': get_userAgent()})
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'User-Agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
verify=False
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
|
||||
|
@ -22,8 +22,7 @@ from .film import download_film
|
||||
# Variable
|
||||
indice = 4
|
||||
_useFor = "film"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "mp4"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -44,7 +44,13 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(url=search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True,
|
||||
verify=False
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -23,8 +23,7 @@ from .series import download_thread
|
||||
# Variable
|
||||
indice = 6
|
||||
_useFor = "serie"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "mp4"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -44,7 +44,12 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -22,8 +22,7 @@ from .series import download_series
|
||||
# Variable
|
||||
indice = 5
|
||||
_useFor = "serie"
|
||||
_deprecate = False
|
||||
_priority = 2
|
||||
_priority = 0
|
||||
_engineDownload = "hls"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -44,7 +44,13 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True,
|
||||
verify=False
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -21,8 +21,7 @@ from .film import download_film
|
||||
# Variable
|
||||
indice = 8
|
||||
_useFor = "film_serie"
|
||||
_deprecate = False
|
||||
_priority = 3
|
||||
_priority = 1 # NOTE: Site search need the use of tmbd obj
|
||||
_engineDownload = "hls"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 3.12.23
|
||||
# 21.05.24
|
||||
|
||||
import os
|
||||
from typing import Tuple
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 3.12.23
|
||||
# 21.05.24
|
||||
|
||||
import os
|
||||
from typing import Tuple
|
||||
|
@ -1,8 +1,9 @@
|
||||
# 10.12.23
|
||||
# 21.05.24
|
||||
|
||||
import threading
|
||||
import queue
|
||||
|
||||
|
||||
# External libraries
|
||||
import httpx
|
||||
from rich.console import Console
|
||||
@ -123,7 +124,13 @@ def title_search(query: str) -> int:
|
||||
}
|
||||
|
||||
try:
|
||||
response = httpx.post(search_url, headers={'user-agent': get_userAgent()}, json=json_data, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.post(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
json=json_data,
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 01.03.24
|
||||
# 21.05.24
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -26,8 +26,7 @@ from .series import download_series
|
||||
# Variable
|
||||
indice = 0
|
||||
_useFor = "film_serie"
|
||||
_deprecate = False
|
||||
_priority = 1
|
||||
_priority = 0
|
||||
_engineDownload = "hls"
|
||||
|
||||
msg = Prompt()
|
||||
|
@ -45,7 +45,13 @@ def title_search(query: str) -> int:
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(search_url, headers={'user-agent': get_userAgent()}, timeout=max_timeout, follow_redirects=True)
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True,
|
||||
verify=False
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
except Exception as e:
|
||||
|
@ -23,7 +23,7 @@ from rich.console import Console
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.headers import get_userAgent
|
||||
from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
|
||||
from StreamingCommunity.Util.config_json import config_manager
|
||||
|
||||
|
||||
# Logic class
|
||||
@ -407,20 +407,12 @@ class M3U8_Segments:
|
||||
"""
|
||||
Generate platform-appropriate progress bar format.
|
||||
"""
|
||||
if not get_use_large_bar():
|
||||
return (
|
||||
f"{Colors.YELLOW}Proc{Colors.WHITE}: "
|
||||
f"{Colors.RED}{{percentage:.2f}}% "
|
||||
f"{Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
|
||||
)
|
||||
|
||||
else:
|
||||
return (
|
||||
f"{Colors.YELLOW}[HLS] {Colors.WHITE}({Colors.CYAN}{description}{Colors.WHITE}): "
|
||||
f"{Colors.RED}{{percentage:.2f}}% "
|
||||
f"{Colors.MAGENTA}{{bar}} "
|
||||
f"{Colors.YELLOW}{{elapsed}}{Colors.WHITE} < {Colors.CYAN}{{remaining}}{Colors.WHITE}{{postfix}}{Colors.WHITE}"
|
||||
)
|
||||
return (
|
||||
f"{Colors.YELLOW}[HLS] {Colors.WHITE}({Colors.CYAN}{description}{Colors.WHITE}): "
|
||||
f"{Colors.RED}{{percentage:.2f}}% "
|
||||
f"{Colors.MAGENTA}{{bar}} "
|
||||
f"{Colors.YELLOW}{{elapsed}}{Colors.WHITE} < {Colors.CYAN}{{remaining}}{Colors.WHITE}{{postfix}}{Colors.WHITE}"
|
||||
)
|
||||
|
||||
def _get_worker_count(self, stream_type: str) -> int:
|
||||
"""
|
||||
|
@ -18,7 +18,7 @@ import qbittorrentapi
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.os import internet_manager
|
||||
from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
|
||||
from StreamingCommunity.Util.config_json import config_manager
|
||||
|
||||
|
||||
# Configuration
|
||||
@ -316,19 +316,12 @@ class TOR_downloader:
|
||||
# Ensure the torrent is started
|
||||
self.qb.torrents_resume(torrent_hashes=self.latest_torrent_hash)
|
||||
|
||||
# Configure progress bar display format based on device
|
||||
if get_use_large_bar():
|
||||
bar_format = (
|
||||
f"{Colors.YELLOW}[TOR] {Colors.WHITE}({Colors.CYAN}video{Colors.WHITE}): "
|
||||
f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ "
|
||||
f"{Colors.YELLOW}{{elapsed}} {Colors.WHITE}< {Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
|
||||
)
|
||||
else:
|
||||
bar_format = (
|
||||
f"{Colors.YELLOW}Proc{Colors.WHITE}: "
|
||||
f"{Colors.RED}{{percentage:.2f}}% {Colors.WHITE}| "
|
||||
f"{Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
|
||||
)
|
||||
# Configure progress bar display format
|
||||
bar_format = (
|
||||
f"{Colors.YELLOW}[TOR] {Colors.WHITE}({Colors.CYAN}video{Colors.WHITE}): "
|
||||
f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ "
|
||||
f"{Colors.YELLOW}{{elapsed}} {Colors.WHITE}< {Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
|
||||
)
|
||||
|
||||
# Initialize progress bar
|
||||
with tqdm(
|
||||
|
@ -36,11 +36,7 @@ def capture_output(process: subprocess.Popen, description: str) -> None:
|
||||
if not line:
|
||||
continue
|
||||
|
||||
logging.info(f"FFMPEG line: {line}")
|
||||
|
||||
# Capture only error
|
||||
if "rror" in str(line):
|
||||
console.log(f"[red]FFMPEG: {str(line).strip()}")
|
||||
logging.info(f"CAPTURE ffmpeg line: {line}")
|
||||
|
||||
# Check if termination is requested
|
||||
if terminate_flag.is_set():
|
||||
|
@ -1,6 +1,5 @@
|
||||
# 21.04.25
|
||||
|
||||
import sys
|
||||
import time
|
||||
import logging
|
||||
import threading
|
||||
@ -14,7 +13,6 @@ from tqdm import tqdm
|
||||
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.config_json import get_use_large_bar
|
||||
from StreamingCommunity.Util.os import internet_manager
|
||||
|
||||
|
||||
@ -32,14 +30,10 @@ class M3U8_Ts_Estimator:
|
||||
self.lock = threading.Lock()
|
||||
self.speed = {"upload": "N/A", "download": "N/A"}
|
||||
self._running = True
|
||||
|
||||
if get_use_large_bar():
|
||||
logging.debug("USE_LARGE_BAR is True, starting speed capture thread")
|
||||
self.speed_thread = threading.Thread(target=self.capture_speed)
|
||||
self.speed_thread.daemon = True
|
||||
self.speed_thread.start()
|
||||
else:
|
||||
logging.debug("USE_LARGE_BAR is False, speed capture thread not started")
|
||||
|
||||
self.speed_thread = threading.Thread(target=self.capture_speed)
|
||||
self.speed_thread.daemon = True
|
||||
self.speed_thread.start()
|
||||
|
||||
def __del__(self):
|
||||
"""Ensure thread is properly stopped when the object is destroyed."""
|
||||
@ -133,29 +127,22 @@ class M3U8_Ts_Estimator:
|
||||
with self.segments_instance.active_retries_lock:
|
||||
retry_count = self.segments_instance.active_retries
|
||||
|
||||
if get_use_large_bar():
|
||||
# Get speed data outside of any locks
|
||||
speed_data = ["N/A", ""]
|
||||
with self.lock:
|
||||
download_speed = self.speed['download']
|
||||
|
||||
if download_speed != "N/A":
|
||||
speed_data = download_speed.split(" ")
|
||||
|
||||
average_internet_speed = speed_data[0] if len(speed_data) >= 1 else "N/A"
|
||||
average_internet_unit = speed_data[1] if len(speed_data) >= 2 else ""
|
||||
|
||||
progress_str = (
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.WHITE}, {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit} "
|
||||
#f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
)
|
||||
|
||||
else:
|
||||
progress_str = (
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size} "
|
||||
#f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
)
|
||||
# Get speed data outside of any locks
|
||||
speed_data = ["N/A", ""]
|
||||
with self.lock:
|
||||
download_speed = self.speed['download']
|
||||
|
||||
if download_speed != "N/A":
|
||||
speed_data = download_speed.split(" ")
|
||||
|
||||
average_internet_speed = speed_data[0] if len(speed_data) >= 1 else "N/A"
|
||||
average_internet_unit = speed_data[1] if len(speed_data) >= 2 else ""
|
||||
|
||||
progress_str = (
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.WHITE}, {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit} "
|
||||
#f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
)
|
||||
|
||||
progress_counter.set_postfix_str(progress_str)
|
||||
|
||||
|
@ -4,7 +4,6 @@ import io
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
import hashlib
|
||||
import logging
|
||||
@ -13,11 +12,9 @@ import inspect
|
||||
import subprocess
|
||||
import contextlib
|
||||
import importlib.metadata
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# External library
|
||||
import httpx
|
||||
from unidecode import unidecode
|
||||
from rich.console import Console
|
||||
from rich.prompt import Prompt
|
||||
@ -357,12 +354,15 @@ class OsSummary:
|
||||
Exits with a message if not the official version.
|
||||
"""
|
||||
python_implementation = platform.python_implementation()
|
||||
python_version = platform.python_version()
|
||||
|
||||
if python_implementation != "CPython":
|
||||
console.print(f"[bold red]Warning: You are using a non-official Python distribution: {python_implementation}.[/bold red]")
|
||||
console.print("Please install the official Python from [bold blue]https://www.python.org[/bold blue] and try again.", style="bold yellow")
|
||||
sys.exit(0)
|
||||
|
||||
console.print(f"[cyan]Python version: [bold red]{python_version}[/bold red]")
|
||||
|
||||
def get_system_summary(self):
|
||||
self.check_python_version()
|
||||
|
||||
|
@ -57,11 +57,8 @@ def load_search_functions():
|
||||
|
||||
# Get 'indice' from the module
|
||||
indice = getattr(mod, 'indice', 0)
|
||||
is_deprecate = bool(getattr(mod, '_deprecate', True))
|
||||
use_for = getattr(mod, '_useFor', 'other')
|
||||
|
||||
if not is_deprecate:
|
||||
modules.append((module_name, indice, use_for))
|
||||
modules.append((module_name, indice, use_for))
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"[red]Failed to import module {module_name}: {str(e)}")
|
||||
|
@ -90,11 +90,8 @@ def load_search_functions():
|
||||
|
||||
# Get 'indice' from the module
|
||||
indice = getattr(mod, 'indice', 0)
|
||||
is_deprecate = bool(getattr(mod, '_deprecate', True))
|
||||
use_for = getattr(mod, '_useFor', 'other')
|
||||
|
||||
if not is_deprecate:
|
||||
modules.append((module_name, indice, use_for))
|
||||
modules.append((module_name, indice, use_for))
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"[red]Failed to import module {module_name}: {str(e)}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user