diff options
| author | ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> | 2023-11-17 07:48:34 -0500 |
|---|---|---|
| committer | ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> | 2023-11-17 08:01:56 -0500 |
| commit | 8338a73e7bc0585edd36bb7fcd4589e741ce0bab (patch) | |
| tree | b619246c1c1e0947195eca2835bc206cff1156d9 /src | |
| parent | 86ee7617887469739fda1dc242442fea93af3187 (diff) | |
| download | invidious-8338a73e7bc0585edd36bb7fcd4589e741ce0bab.tar.gz invidious-8338a73e7bc0585edd36bb7fcd4589e741ce0bab.tar.bz2 invidious-8338a73e7bc0585edd36bb7fcd4589e741ce0bab.zip | |
add user_agent if empty or crystal
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/yt_backend/connection_pool.cr | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr index fbf05803..36e82766 100644 --- a/src/invidious/yt_backend/connection_pool.cr +++ b/src/invidious/yt_backend/connection_pool.cr @@ -1,7 +1,6 @@ def add_yt_headers(request) - if request.headers["User-Agent"] == "Crystal" - request.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" - end + request.headers.delete("User-Agent") if request.headers["User-Agent"] == "Crystal" + request.headers["User-Agent"] ||= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" request.headers["Accept-Charset"] ||= "ISO-8859-1,utf-8;q=0.7,*;q=0.7" request.headers["Accept"] ||= "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" |
