├── .env ├── Dockerfile ├── README.md ├── chatRecord ├── squid.mhtml ├── youtube_api.mhtml └── youtube_api_3.mhtml ├── main.py ├── requirements.txt └── youtube_utils.py /.env: -------------------------------------------------------------------------------- 1 | CHATGPT_EMAIL= 2 | CHATGPT_PASSWORD= 3 | CHAT_KEYWORD='Q:' 4 | VIDEO_ID= 5 | PROXY_ADDRESS= 6 | GOOGLE_API_KEY= 7 | ROOT_FOLDER='/app' 8 | DESCRIPTION_TEXT='!!! Need more Likes or Subscription to keep this working !!!' 9 | INTERVAL=60 10 | SUBSCRIBE_POWER=3 11 | LIKE_POWER=1 12 | NOTIFY_ON_YOUTUBE_ERROR=1 13 | NOTIFY_ON_OPENAI_ERROR=1 14 | EMAIL_WEBHOOK_URL= 15 | WEBHOOK_BASIC_AUTH_USERNAME= 16 | WEBHOOK_BASIC_AUTH_PASSWORD= -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a base image 2 | FROM python:slim 3 | 4 | # Set the working directory to /app 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install any needed packages specified in requirements.txt 11 | RUN pip install -r requirements.txt 12 | 13 | # Run main.py when the container launches 14 | CMD ["python", "main.py"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChatGPT youtube autoreply 2 | 3 | 🚧 Detail README is still under construction 🚧 4 | 5 | [ Quick version ] 6 | 7 | 🎥 This is a python program that use Chatgpt to automatically reply to comments under a specific YouTube video. 8 | 9 | 🤖 Nothing special about the code. What is special is that ~70% of the code is done though conversation with Chatgpt. 10 | 11 | 🗨️ If you are interested in the process, the whole conversation is available inside the chat record folder. 12 | 13 | ## Current features 14 | 1. Use keyword filter to limit auto reply to a group of comments 15 | 2. Limit auto reply quota using number of like and subscription 😉 16 | 3. All adjustable configurations are included in .env 17 | 4. Fully automatic login, no human interaction needed 18 | 19 | ## Limitations 20 | 1. Will only reply to top level comments 21 | 22 | ## Todo 23 | 1. Add context persistent conversation under a comment thread 24 | 2. Tune a channel dedicated chat AI 25 | 26 | ## My thoughts on Chatgpt and details on how I have code with it 27 | 28 | [廣東話] https://youtu.be/O8si34bnE6E 29 | 30 | [English] Coming soon 🚧 31 | -------------------------------------------------------------------------------- /chatRecord/squid.mhtml: -------------------------------------------------------------------------------- 1 | From: 2 | Snapshot-Content-Location: https://chat.openai.com/chat 3 | Subject: ChatGPT 4 | Date: Thu, 8 Dec 2022 03:39:56 -0000 5 | MIME-Version: 1.0 6 | Content-Type: multipart/related; 7 | type="text/html"; 8 | boundary="----MultipartBoundary--IDvrwp5h601RRHZKLtGAjiGbMXzviQpemDaigCFWkd----" 9 | 10 | 11 | ------MultipartBoundary--IDvrwp5h601RRHZKLtGAjiGbMXzviQpemDaigCFWkd---- 12 | Content-Type: text/html 13 | Content-ID: 14 | Content-Transfer-Encoding: quoted-printable 15 | Content-Location: https://chat.openai.com/chat 16 | 17 | <= 45 | title>ChatGPT
= 58 |
= 61 |
3D""3D"sheldon.kw.chiu=
how to setup a forward proxy in linux
<= 160 | /div>
= 166 | 2 / 2
  1. = 176 | Install the required proxy server software, such as Squid or Privoxy.
  2. <= 177 | li>Configure the proxy server settings, such as the listening port and allo= 178 | wed client IP addresses.
  3. Set up authentication for the proxy server= 179 | , if desired.
  4. Enable the proxy server to start automatically on sys= 180 | tem boot.
  5. Test the proxy server by setting up a client device to us= 181 | e it as a forward proxy.
  6. Monitor the proxy server's performance and= 182 | adjust settings as needed.
3D""3D"sheldon.k=
how to setup squid
<= 297 | div class=3D"relative lg:w-[calc(100%-115px)] w-full flex flex-col">
  1. Install Squid using the package manager for your Linux distr= 301 | ibution.
  2. Open the Squid configuration file in a text editor, usuall= 302 | y located at /etc/squid/squid.conf.
  3. Modify the configuration option= 303 | s to specify the listening port, allowed client IP addresses, and other set= 304 | tings as desired.
  4. Save the configuration file and restart Squid for= 305 | the changes to take effect.
  5. Test the Squid proxy server by setting= 306 | up a client device to use it as a forward proxy.
  6. Monitor the Squid= 307 | server's performance and adjust settings as needed.
<= 308 | div class=3D"text-gray-400 flex self-end lg:self-center justify-center mt-2= 309 | gap-4 lg:gap-1 lg:absolute lg:top-0 lg:translate-x-full lg:right-0 lg:mt-0= 310 | lg:pl-2">
3D""3D""
how to setup squid in ubuntu
  1. Install Squid using the apt package manager:
<= 439 | pre>
sudo apt update 449 | sudo apt install squid 450 |
  1. Open the Squid configuration f= 451 | ile in a text editor, usually located at /etc/squid/squid.conf.
  2. Mod= 452 | ify the configuration options to specify the listening port, allowed client= 453 | IP addresses, and other settings as desired.
  3. Save the configuratio= 454 | n file and restart Squid for the changes to take effect:
sudo service squid restart 464 |
  1. Test the Squid proxy server by= 465 | setting up a client device to use it as a forward proxy.
  2. Monitor t= 466 | he Squid server's performance and adjust settings as needed.
3D""
how to allow my ip to = 508 | use this proxy

To allow your IP= 585 | address to use the proxy server, you need to add it to the list of allowed= 586 | client IP addresses in the proxy server's configuration.

  1. Open t= 587 | he proxy server's configuration file in a text editor.
  2. Find the sec= 588 | tion for allowed client IP addresses, which may be called "acl" or "access = 589 | control list".
  3. Add your IP address to the list of allowed IP addres= 590 | ses, using the following syntax:
acl allowed_clients src <your_IP_address> 601 |
  1. Save the configuration file an= 602 | d restart the proxy server for the changes to take effect.

Note= 603 | : If your IP address frequently changes, you can use a range of IP addresse= 604 | s or a domain name instead of a specific IP address in the allowed client l= 605 | ist.

6323D""
this is not= 646 | working, anything missing?

It = 723 | is difficult to determine what may be causing the issue without more inform= 724 | ation. Some potential issues that may cause the proxy server to not work pr= 725 | operly include:

  • Incorrectly configured proxy server settings, su= 726 | ch as the listening port or allowed client IP addresses.
  • Firewall r= 727 | ules that block access to the proxy server's listening port.
  • Networ= 728 | k connectivity issues that prevent the client device from reaching the prox= 729 | y server.
  • Incorrect proxy server address or port number specified o= 730 | n the client device.
  • Authentication issues, if the proxy server req= 731 | uires authentication.

To troubleshoot the issue, you can try th= 732 | e following steps:

  1. Check the proxy server's configuration file a= 733 | nd ensure that the settings are correct and match the client device's setti= 734 | ngs.
  2. Check the firewall rules and ensure that they allow access to = 735 | the proxy server's listening port.
  3. Test the network connectivity by= 736 | trying to ping the proxy server from the client device.
  4. Check the = 737 | proxy server logs for any errors or issues that may be causing the problem.= 738 |
  5. If the proxy server requires authentication, verify that the clien= 739 | t device is using the correct username and password.
<= 740 | div class=3D"text-gray-400 flex self-end lg:self-center justify-center mt-2= 741 | gap-4 lg:gap-1 lg:absolute lg:top-0 lg:translate-x-full lg:right-0 lg:mt-0= 742 | lg:pl-2">
3D""3D""
my ip is 1.1.1.1, below is my sq= 781 | uid configuration, why am I getting 403 status code 782 | ''' 783 | acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN) 784 | acl localnet src 10.0.0.0/8 # RFC 1918 local private network (L= 785 | AN) 786 | acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CG= 787 | N) 788 | acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plu= 789 | gged) machines 790 | acl localnet src 172.16.0.0/12 # RFC 1918 local private network (L= 791 | AN) 792 | acl localnet src 192.168.0.0/16 # RFC 1918 local private network (L= 793 | AN) 794 | acl localnet src fc00::/7 # RFC 4193 local private network ra= 795 | nge 796 | acl localnet src fe80::/10 # RFC 4291 link-local (directly plu= 797 | gged) machines 798 | acl SSL_ports port 443 799 | acl Safe_ports port 80 # http 800 | acl Safe_ports port 21 # ftp 801 | acl Safe_ports port 443 # https 802 | acl Safe_ports port 70 # gopher 803 | acl Safe_ports port 210 # wais 804 | acl Safe_ports port 1025-65535 # unregistered ports 805 | acl Safe_ports port 280 # http-mgmt 806 | acl Safe_ports port 488 # gss-http 807 | acl Safe_ports port 591 # filemaker 808 | acl Safe_ports port 777 # multiling http 809 | http_access deny !Safe_ports 810 | http_access deny CONNECT !SSL_ports 811 | http_access allow localhost manager 812 | http_access deny manager 813 | include /etc/squid/conf.d/*.conf 814 | http_access allow localhost 815 | http_access deny all 816 | http_port 3128 817 | coredump_dir /var/spool/squid 818 | refresh_pattern ^ftp: 1440 20% 10080 819 | refresh_pattern ^gopher: 1440 0% 1440 820 | refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 821 | refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims 822 | refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims 823 | refresh_pattern \/InRelease$ 0 0% 0 refresh-ims 824 | refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims 825 | refresh_pattern . 0 20% 4320 826 | ''' 827 |
= 837 |
<= 841 | div class=3D"relative h-[30px] w-[30px] p-1 rounded-sm text-white flex item= 842 | s-center justify-center" style=3D"background-color: rgb(16, 163, 127);">
2 / 2

The issue may be caused by the fact that your IP addres= 917 | s is not included in any of the allowed client IP address ranges in the Squ= 918 | id configuration. The configuration specifies several ranges of allowed IP = 919 | addresses, such as 10.0.0.0/8 and 192.168.0.0/16, but none of these ranges = 920 | include the IP address 1.1.1.1.

To fix the issue, you can add your IP= 921 | address to the list of allowed client IP addresses in the Squid configurat= 922 | ion. For example, you can add the following line to the configuration file:= 923 |

acl allowed_clients src 1.1.1.1 934 |

Then, you can add the following line to the "ht= 935 | tp_access" section to allow access for clients with this IP address:

http_access allow allowed_clients 945 |

Save the configuration file and restart Squid f= 946 | or the changes to take effect. After that, your IP address should be able t= 947 | o access the proxy server without getting a 403 error.

<= 965 | /div>
<= 977 | /div>