kbwhodat / gonchill

A golang cli that allow you to stream whatever you want... and chill
3 stars 0 forks source link

Server returned 403 #1

Closed judexgauss closed 3 months ago

judexgauss commented 4 months ago

Hi! Tried gonchill series -v true detective and got this message 2024/06/30 13:56:16 Server returned non-200 status code: 403.

kbwhodat commented 3 months ago

Hi! Tried gonchill series -v true detective and got this message 2024/06/30 13:56:16 Server returned non-200 status code: 403.

Hi @judexgauss thanks for the motivation. 403 was due to CloudFlare stuff. I had to use some Python to get past it. I'm also using Python to generate cookies, I'm also checking if they're expired and fetching new cookies. So make sure you install the Python dependencies I added to my requirements.txt.

For the most part, you should be good to go to watch whatever you want! Let me know if you face any issues.

judexgauss commented 3 months ago

@kbwhodat thanks! Could you also update AUR package so i can test it? I assume you are maintainer of this package and have acess to updating it.

UPD: btw, tried to run go run . series -v true detective on git version after installing requirements.txt and got this exception:

2024/07/07 06:41:58 No cookies file found, generating fresh cookies
2024/07/07 06:41:58 cmd.Run() failed with exit status 1
2024/07/07 06:41:58 stderr: Traceback (most recent call last):
  File "/home/goose/gonchill/scripts/setcookies.py", line 1, in <module>
    import undetected_chromedriver as uc
  File "/home/goose/gonchill/.venv/lib/python3.12/site-packages/undetected_chromedriver/__init__.py", line 44, in <module>
    from .patcher import IS_POSIX
  File "/home/goose/gonchill/.venv/lib/python3.12/site-packages/undetected_chromedriver/patcher.py", line 4, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
2024/07/07 06:41:58 open scripts/cookies.json: no such file or directory
exit status 1
(.venv) 

It seems like distutils need to be add to requirements.txt if i correctly understand (but mb i'm wrong and it's something else)

kbwhodat commented 3 months ago

@kbwhodat thanks! Could you also update AUR package so i can test it? I assume you are maintainer of this package and have acess to updating it.

UPD: btw, tried to run go run . series -v true detective on git version after installing requirements.txt and got this exception:

2024/07/07 06:41:58 No cookies file found, generating fresh cookies
2024/07/07 06:41:58 cmd.Run() failed with exit status 1
2024/07/07 06:41:58 stderr: Traceback (most recent call last):
  File "/home/goose/gonchill/scripts/setcookies.py", line 1, in <module>
    import undetected_chromedriver as uc
  File "/home/goose/gonchill/.venv/lib/python3.12/site-packages/undetected_chromedriver/__init__.py", line 44, in <module>
    from .patcher import IS_POSIX
  File "/home/goose/gonchill/.venv/lib/python3.12/site-packages/undetected_chromedriver/patcher.py", line 4, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
2024/07/07 06:41:58 open scripts/cookies.json: no such file or directory
exit status 1
(.venv) 

It seems like distutils need to be add to requirements.txt if i correctly understand (but mb i'm wrong and it's something else)

@judexgauss I made more changes because I realized my initial changes did not work on MacOS - it should now. I also pushed the 1.0.6 version to AUR. I use NixOS and not Arch, however, I did spin up a docker container running an Arch image and it seemed to work from there.

I still need to work cookie expiration logic. I'm traveling so will work on it later. If you see a 403 and its using the current cookies, delete the cookies.json in the /tmp directory. Also to generate fresh cookies it take around 10-12 seconds, if it takes longer than then re-execute the binary.

judexgauss commented 3 months ago

@kbwhodat tested AUR package on arch linux, it's working now. Thanks!
Closing issue as solved

kbwhodat commented 3 months ago

Awesome! Glad it worked, enjoy!