diff --git a/README.md b/README.md index 908b351..cd6df63 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,39 @@ **We recommend using at least Deepseek 14B—smaller models struggle with tool use and memory retention.** -### 1️⃣ **Install Dependencies** +### 1️⃣ **Install Dependencies** + + +**Install requirements** + ```sh +sudo apt-get update pip3 install -r requirements.txt ``` +**Install chromedriver** + +```sh +# linux +pip install selenium + +# macos +brew install --cask chromedriver + +# windows +https://sites.google.com/chromium.org/driver/getting-started +``` + +**Install pyAudio** + +```sh +# linux +sudo apt-get install portaudio19-dev python3-dev + +#macos +brew install portaudio +``` + ### 2️⃣ **Download Models** Make sure you have [Ollama](https://ollama.com/) installed. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..06d9ef9 --- /dev/null +++ b/install.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +SCRIPTS_DIR="scripts" + +echo "Detecting operating system..." + +OS_TYPE=$(uname -s) + +case "$OS_TYPE" in + "Linux"*) + echo "Detected Linux OS" + if [ -f "$SCRIPTS_DIR/linux_install.sh" ]; then + echo "Running Linux installation script..." + bash "$SCRIPTS_DIR/linux_install.sh" + else + echo "Error: $SCRIPTS_DIR/linux_install.sh not found!" + exit 1 + fi + ;; + "Darwin"*) + echo "Detected macOS" + if [ -f "$SCRIPTS_DIR/macos_install.sh" ]; then + echo "Running macOS installation script..." + bash "$SCRIPTS_DIR/macos_install.sh" + else + echo "Error: $SCRIPTS_DIR/macos_install.sh not found!" + exit 1 + fi + ;; + "MINGW"* | "MSYS"* | "CYGWIN"*) + echo "Detected Windows (via Bash-like environment)" + if [ -f "$SCRIPTS_DIR/windows_install.sh" ]; then + echo "Running Windows installation script..." + bash "$SCRIPTS_DIR/windows_install.sh" + else + echo "Error: $SCRIPTS_DIR/windows_install.sh not found!" + exit 1 + fi + ;; + *) + echo "Unsupported OS detected: $OS_TYPE" + echo "This script supports Linux, macOS, and Windows (via Bash-compatible environments)." + exit 1 + ;; +esac + +echo "Installation process finished!" \ No newline at end of file diff --git a/scripts/linux_install.sh b/scripts/linux_install.sh new file mode 100644 index 0000000..3077e74 --- /dev/null +++ b/scripts/linux_install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Starting installation for Linux..." + +# Update package list +sudo apt-get update + +# Install Python dependencies from requirements.txt +pip3 install -r requirements.txt + +# Install Selenium for chromedriver +pip3 install selenium + +# Install portaudio for pyAudio +sudo apt-get install -y portaudio19-dev python3-dev + +echo "Installation complete for Linux!" \ No newline at end of file diff --git a/scripts/macos_install.sh b/scripts/macos_install.sh new file mode 100644 index 0000000..8a4bd5c --- /dev/null +++ b/scripts/macos_install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Starting installation for macOS..." + +# Install Python dependencies from requirements.txt +pip3 install -r requirements.txt + +# Install chromedriver using Homebrew +brew install --cask chromedriver + +# Install portaudio for pyAudio using Homebrew +brew install portaudio + +# Install Selenium +pip3 install selenium + +echo "Installation complete for macOS!" \ No newline at end of file diff --git a/scripts/windows_install.sh b/scripts/windows_install.sh new file mode 100644 index 0000000..be52171 --- /dev/null +++ b/scripts/windows_install.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +echo "Starting installation for Windows..." + +# Install Python dependencies from requirements.txt +pip3 install -r requirements.txt + +# Install Selenium +pip3 install selenium + +echo "Note: pyAudio installation may require additional steps on Windows." +echo "Please install portaudio manually (e.g., via vcpkg or prebuilt binaries) and then run: pip3 install pyaudio" +echo "Also, download and install chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started" +echo "Place chromedriver in a directory included in your PATH." + +echo "Installation partially complete for Windows. Follow manual steps above." \ No newline at end of file diff --git a/sources/browser.py b/sources/browser.py index 279c68a..5484c4b 100644 --- a/sources/browser.py +++ b/sources/browser.py @@ -12,8 +12,15 @@ import logging import sys class Browser: - def __init__(self, headless=False): + def __init__(self, headless=False, anticaptcha_install=False): """Initialize the browser with optional headless mode.""" + self.headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', + 'Accept-Language': 'en-US,en;q=0.9', + 'Referer': 'https://www.google.com/', + } + self.anticaptcha = "https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related" try: chrome_options = Options() if headless: