Skip to content

Commit e46e618

Browse files
committed
Fix proxying for videos
1 parent b49623f commit e46e618

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/invidious.cr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,6 @@ get "/api/v1/comments/:id" do |env|
18851885
proxy_client.read_timeout = 10.seconds
18861886
proxy_client.connect_timeout = 10.seconds
18871887

1888-
proxy = list.sample(1)[0]
18891888
proxy = HTTPProxy.new(proxy_host: proxy[:ip], proxy_port: proxy[:port])
18901889
proxy_client.set_proxy(proxy)
18911890

@@ -1894,13 +1893,10 @@ get "/api/v1/comments/:id" do |env|
18941893
proxy_headers["cookie"] = response.cookies.add_request_headers(headers)["cookie"]
18951894
proxy_html = response.body
18961895

1897-
if proxy_html.match(/<meta itemprop="regionsAllowed" content="">/)
1898-
bypass_channel.send(nil)
1899-
else
1896+
if !proxy_html.match(/<meta itemprop="regionsAllowed" content="">/)
19001897
bypass_channel.send({proxy_html, proxy_client, proxy_headers})
1898+
break
19011899
end
1902-
1903-
break
19041900
rescue ex
19051901
end
19061902
end

src/invidious/channels.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def produce_channel_videos_url(ucid, page = 1, auto_generated = nil)
176176
continuation = Base64.urlsafe_encode(continuation)
177177
continuation = URI.escape(continuation)
178178

179-
url = "/browse_ajax?continuation=#{continuation}"
179+
url = "/browse_ajax?continuation=#{continuation}&gl=US&hl=en"
180180

181181
return url
182182
end

src/invidious/videos.cr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,8 @@ def fetch_video(id, proxies)
573573
info = HTTP::Params.parse(client.get("/get_video_info?video_id=#{id}&ps=default&eurl=&gl=US&hl=en&disable_polymer=1").body)
574574
if !info["reason"]?
575575
bypass_channel.send(proxy)
576-
else
577-
bypass_channel.send(nil)
576+
break
578577
end
579-
580-
break
581578
rescue ex
582579
end
583580
end

0 commit comments

Comments
 (0)