diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-10-10 22:03:25 -0400 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-10-10 22:03:39 -0400 |
| commit | dad885c051e7ea7fa0734dac01bf4bdaf8429c07 (patch) | |
| tree | a0f2636e30c485999041ea904ddbcd5ea9b2bace | |
| parent | f5c7bbfda868fd387c437d91dfacd35b1dfa6297 (diff) | |
| download | invidious-dad885c051e7ea7fa0734dac01bf4bdaf8429c07.tar.gz invidious-dad885c051e7ea7fa0734dac01bf4bdaf8429c07.tar.bz2 invidious-dad885c051e7ea7fa0734dac01bf4bdaf8429c07.zip | |
Add YouTube-Client headers to HTTP requests
| -rw-r--r-- | src/invidious/helpers/proxy.cr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/invidious/helpers/proxy.cr b/src/invidious/helpers/proxy.cr index fde282cd..388d6827 100644 --- a/src/invidious/helpers/proxy.cr +++ b/src/invidious/helpers/proxy.cr @@ -86,6 +86,16 @@ class HTTPClient < HTTP::Client return opts end + + def exec(request) + if self.host == "www.youtube.com" + request.headers["x-youtube-client-name"] = "1" + request.headers["x-youtube-client-version"] = "2.20180719" + request.headers["user-agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" + end + + super + end end def get_proxies(country_code = "US") |
