Vary user-agent

This commit is contained in:
Omar Roth 2019-10-25 18:02:33 -04:00
parent 6930570fa2
commit e05a25d701
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
2 changed files with 1587 additions and 1 deletions

View File

@ -95,7 +95,10 @@ class HTTPClient < HTTP::Client
if self.host == "www.youtube.com"
request.headers["x-youtube-client-name"] ||= "1"
request.headers["x-youtube-client-version"] ||= "1.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"
request.headers["user-agent"] ||= random_user_agent
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"
request.headers["accept-language"] ||= "en-us,en;q=0.5"
end
super

File diff suppressed because it is too large Load Diff