Improve URL replacement regex in HLS manifest logic

Co-authored-by: Samantaz Fox <coding@samantaz.fr>
This commit is contained in:
syeopite 2023-09-27 22:38:48 +00:00 committed by syeopite
parent 2d1617a46a
commit 2b1a940298
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A

View File

@ -177,7 +177,7 @@ module Invidious::Routes::API::Manifest
manifest = response.body manifest = response.body
if local if local
manifest = manifest.gsub(/^(https:\/\/\w+---.{11}\.c\.youtube\.com[^\n]*)|(https:\/\/\w+---.{11}\.googlevideo\.com[^\n]*)/m) do |match| manifest = manifest.gsub(/https:\/\/\w+---.{11}(\.c\.youtube\.com|\.googlevideo\.com)[^\n]*/m) do |match|
path = URI.parse(match).path path = URI.parse(match).path
path = path.lchop("/videoplayback/") path = path.lchop("/videoplayback/")