This commit is contained in:
syeopite 2021-05-23 06:50:47 -07:00
parent 8cad76b2cf
commit ba77812a85
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
2 changed files with 9 additions and 10 deletions

View File

@ -101,8 +101,8 @@ class Config
property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument)
property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
property use_quic : Bool = true # Use quic transport for youtube api
property quic_proxy_address : String = "0.0.0.0" # Address for the QUIC proxy
property quic_proxy_port : Int32 = 7192 # Port for the Quic Proxy
property quic_proxy_address : String = "0.0.0.0" # Address for the QUIC proxy
property quic_proxy_port : Int32 = 7192 # Port for the Quic Proxy
@[YAML::Field(converter: Preferences::StringToCookies)]
property cookies : HTTP::Cookies = HTTP::Cookies.new # Saved cookies in "name1=value1; name2=value2..." format

View File

@ -61,7 +61,7 @@ struct YoutubeConnectionPool
end
class QuicProxyWrapper
property yt_headers : Hash(String, String)
property yt_headers : Hash(String, String)
property family : Socket::Family
def initialize(url : URI)
@ -72,13 +72,12 @@ class QuicProxyWrapper
@yt_headers = header_retreival.headers
# Scans through yt_headers and makes sure that all values are strings.
@yt_headers.each do |k,v|
@yt_headers.each do |k, v|
if v.is_a? Array
@yt_headers[k] = v[0]
end
end
end
def family=(value)
@conn.family = value
@ -150,12 +149,12 @@ class QuicProxyWrapper
end
{% end %}
def post(url, headers, form)
headers = convert_headers(headers)
headers.merge!(@yt_headers)
data = {"method" => "POST", "url" => "#{YT_URL.to_s}#{url}",
"headers"=>headers.to_h, "data" => form}.to_json
"headers" => headers.to_h, "data" => form}.to_json
return @conn.post("/", body: data)
end
@ -175,15 +174,15 @@ end
# We're just using this to retreive the headers from add_yt_headers
class HackyHeaderRetrevialClass
def initialize()
def initialize
@headers_dict = {} of String => String
end
def headers()
def headers
return @headers_dict
end
def resource()
def resource
return ""
end
end