Skip to content

Commit c869c8f

Browse files
committed
edit readme and add warnings if cookie not found
1 parent 9e21f7e commit c869c8f

2 files changed

Lines changed: 73 additions & 0 deletions

File tree

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,75 @@ You can find more information about available commands with
6767
torchlight --help
6868
```
6969

70+
## YouTube Cookies
71+
72+
In some environments (VPS, dedicated servers, VPN/WARP containers), YouTube search may fail due to rate limits or bot protection.
73+
Providing a valid YouTube cookie file can resolve this issue.
74+
75+
Configure the cookie file in:
76+
77+
`Sounds > CookieFile`
78+
79+
inside your JSON configuration.
80+
81+
---
82+
83+
### How to Get YouTube Cookies
84+
85+
1. Install a browser extension that exports cookies in **Netscape format (`cookies.txt`)**
86+
- Chrome: **Get cookies.txt LOCALLY**
87+
- Firefox: **cookies.txt**
88+
89+
2. Open https://youtube.com and make sure you are logged in.
90+
91+
3. Use the extension to export cookies for `youtube.com`.
92+
93+
4. Save the file as:
94+
95+
```
96+
cookies.txt
97+
```
98+
99+
5. Upload it to your server (example):
100+
101+
```
102+
/app/config/cookies.txt
103+
```
104+
105+
6. Set the path in your configuration:
106+
107+
```json
108+
{
109+
"YoutubeSearch": {
110+
"parameters": {
111+
"proxy": "",
112+
"keywords_banned": [],
113+
"cookies": "config/cookies.txt"
114+
}
115+
}
116+
}
117+
```
118+
119+
7. Restart the container after updating the configuration.
120+
121+
8. It's prefered to use **Cloudflare WARP** (recommended for VPS environments), you can run it using:
122+
https://github.com/cmj2002/warp-docker
123+
124+
Then configure Torchlight to use the WARP container's socks5 proxy:
125+
126+
```yaml
127+
"proxy": "socks5://0.0.0.0:PORT"
128+
```
129+
130+
This routes all requests through WARP, which helps prevent YouTube blocking server IP addresses.
131+
---
132+
133+
### Notes
134+
135+
- Keep your cookie file private (it contains session authentication data).
136+
- If YouTube search stops working, export fresh cookies.
137+
- Do **not** share your cookie file publicly.
138+
70139
## Docker
71140
```
72141
version: '3.7'

src/torchlight/Commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,11 @@ async def _func(self, message: list[str], player: Player) -> int:
913913

914914
proxy: str = command_config.get("parameters", {}).get("proxy", "")
915915
cookies: str = command_config.get("parameters", {}).get("cookies", "")
916+
if not cookies:
917+
self.logger.warning(f"Parameters/Cookies is empty, please consider adding your own cookies file")
918+
916919
if cookies and not os.path.isfile(cookies):
920+
self.logger.warning(f"Cookies file not found: {cookies}, ignoring")
917921
cookies = ""
918922

919923
try:

0 commit comments

Comments
 (0)