Skip to content

Instantly share code, notes, and snippets.

@HunterXProgrammer
Last active February 25, 2025 10:51
Show Gist options
  • Save HunterXProgrammer/4d41c257f90878e9645f1fa220f8d54f to your computer and use it in GitHub Desktop.
Save HunterXProgrammer/4d41c257f90878e9645f1fa220f8d54f to your computer and use it in GitHub Desktop.

Revisions

  1. HunterXProgrammer revised this gist Jul 9, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -20,11 +20,11 @@ sleep 5

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION -d package:com.termux

    apt update
    yes | pkg upgrade -y

    pkg install -y tur-repo x11-repo git python-pip
    yes | pkg install -y tur-repo x11-repo git python-pip

    pkg install -y chromium
    yes | pkg install -y chromium

    pkg clean

  2. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    #!/data/data/com.termux/files/usr/bin/bash

    am start -a android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -d package:com.termux

    echo -ne "\n Checking if Termux has storage permission..."
    rm -r ~/storage >/dev/null 2>&1
    if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    @@ -29,8 +32,6 @@ apt autoremove

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

    am start -a android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -d package:com.termux

    chat_automation_dir="$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null)/chatgpt_automation"

    sed -i '/out = subprocess/d' "${chat_automation_dir}/helpers.py"
  3. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ echo -e "\n Grant Termux Display over other apps permission"

    sleep 5

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux
    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION -d package:com.termux

    apt update

    @@ -29,6 +29,8 @@ apt autoremove

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

    am start -a android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -d package:com.termux

    chat_automation_dir="$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null)/chatgpt_automation"

    sed -i '/out = subprocess/d' "${chat_automation_dir}/helpers.py"
  4. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -17,8 +17,6 @@ sleep 5

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux

    # pkg upgrade -y

    apt update

    pkg install -y tur-repo x11-repo git python-pip
  5. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,9 @@ sleep 5

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux

    pkg upgrade -y
    # pkg upgrade -y

    apt update

    pkg install -y tur-repo x11-repo git python-pip

  6. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    #!/data/data/com.termux/files/usr/bin/bash

    echo -ne "\n Checking if Termux has storage permission..."
    rm -r ~/storage >/dev/null 2>&1
    if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
  7. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    #!/data/data/com.termux/files/usr/bin/bash

    echo -ne "\n Checking if Termux has storage permission..."
    rm -r ~/storage >/dev/null 2>&1
    if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    @@ -25,6 +26,8 @@ pkg install -y chromium

    pkg clean

    apt autoremove

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

    chat_automation_dir="$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null)/chatgpt_automation"
  8. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ pkg install -y tur-repo x11-repo git python-pip

    pkg install -y chromium

    apt clean
    pkg clean

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

  9. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,8 @@ pkg install -y tur-repo x11-repo git python-pip

    pkg install -y chromium

    apt clean

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

    chat_automation_dir="$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null)/chatgpt_automation"
  10. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ rm -rf /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    termux-setup-storage
    echo "done"

    echo " Grant Termux Display over other apps permission"
    echo -e "\n Grant Termux Display over other apps permission"

    sleep 5

  11. HunterXProgrammer revised this gist Jul 7, 2023. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,12 @@ rm -rf /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    termux-setup-storage
    echo "done"

    echo " Grant Termux Display over other apps permission"

    sleep 5

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux

    pkg upgrade -y

    pkg install -y tur-repo x11-repo git python-pip
    @@ -27,6 +33,4 @@ sed -i "s/out = re.*/out = re.search\(r\'\(\\d{3}\)\', \"110\"\)/" "${chat_autom

    sed -i 's#driver_executable_path=driver_executable_path,#driver_executable_path="/data/data/com.termux/files/usr/bin/chromedriver",#' "${chat_automation_dir}/chatgpt_client.py"

    value="true"; key="allow-external-apps"; file="/data/data/com.termux/files/home/.termux/termux.properties"; mkdir -p "$(dirname "$file")"; chmod 700 "$(dirname "$file")"; if ! grep -E '^'"$key"'=.*' $file &>/dev/null; then [[ -s "$file" && ! -z "$(tail -c 1 "$file")" ]] && newline=$'\n' || newline=""; echo "$newline$key=$value" >> "$file"; else sed -i'' -E 's/^'"$key"'=.*/'"$key=$value"'/' $file; fi

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux
    value="true"; key="allow-external-apps"; file="/data/data/com.termux/files/home/.termux/termux.properties"; mkdir -p "$(dirname "$file")"; chmod 700 "$(dirname "$file")"; if ! grep -E '^'"$key"'=.*' $file &>/dev/null; then [[ -s "$file" && ! -z "$(tail -c 1 "$file")" ]] && newline=$'\n' || newline=""; echo "$newline$key=$value" >> "$file"; else sed -i'' -E 's/^'"$key"'=.*/'"$key=$value"'/' $file; fi
  12. HunterXProgrammer created this gist Jul 7, 2023.
    32 changes: 32 additions & 0 deletions chatgpt_selenium_termux.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/data/data/com.termux/files/usr/bin/bash
    echo -ne "\n Checking if Termux has storage permission..."
    rm -r ~/storage >/dev/null 2>&1
    if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    then
    echo -e "\nGrant Termux storage permission and run the script again\n"
    termux-setup-storage
    exit 1
    fi
    rm -rf /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
    termux-setup-storage
    echo "done"

    pkg upgrade -y

    pkg install -y tur-repo x11-repo git python-pip

    pkg install -y chromium

    pip install -U selenium undetected-chromedriver git+https://github.com/ugorsahin/ChatGPT_Automation

    chat_automation_dir="$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null)/chatgpt_automation"

    sed -i '/out = subprocess/d' "${chat_automation_dir}/helpers.py"

    sed -i "s/out = re.*/out = re.search\(r\'\(\\d{3}\)\', \"110\"\)/" "${chat_automation_dir}/helpers.py"

    sed -i 's#driver_executable_path=driver_executable_path,#driver_executable_path="/data/data/com.termux/files/usr/bin/chromedriver",#' "${chat_automation_dir}/chatgpt_client.py"

    value="true"; key="allow-external-apps"; file="/data/data/com.termux/files/home/.termux/termux.properties"; mkdir -p "$(dirname "$file")"; chmod 700 "$(dirname "$file")"; if ! grep -E '^'"$key"'=.*' $file &>/dev/null; then [[ -s "$file" && ! -z "$(tail -c 1 "$file")" ]] && newline=$'\n' || newline=""; echo "$newline$key=$value" >> "$file"; else sed -i'' -E 's/^'"$key"'=.*/'"$key=$value"'/' $file; fi

    am start -a android.settings.action.MANAGE_OVERLAY_PERMISSION --es package com.termux