mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-23 00:29:53 +05:30
Update regex expressions to handle unexpected '};'
This commit is contained in:
parent
2c1cf42994
commit
608313c1d1
@ -678,7 +678,7 @@ def create_notification_stream(env, topics, connection_channel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def extract_initial_data(body) : Hash(String, JSON::Any)
|
def extract_initial_data(body) : Hash(String, JSON::Any)
|
||||||
return JSON.parse(body.match(/(window\["ytInitialData"\]|var\s*ytInitialData)\s*=\s*(?<info>\{.*?\});/mx).try &.["info"] || "{}").as_h
|
return JSON.parse(body.match(/(window\["ytInitialData"\]|var\s*ytInitialData)\s*=\s*(?<info>{.*?});<\/script>/mx).try &.["info"] || "{}").as_h
|
||||||
end
|
end
|
||||||
|
|
||||||
def proxy_file(response, env)
|
def proxy_file(response, env)
|
||||||
|
@ -818,7 +818,7 @@ end
|
|||||||
|
|
||||||
def extract_polymer_config(body)
|
def extract_polymer_config(body)
|
||||||
params = {} of String => JSON::Any
|
params = {} of String => JSON::Any
|
||||||
player_response = body.match(/(window\["ytInitialPlayerResponse"\]|var\sytInitialPlayerResponse)\s*=\s*(?<info>{.*?});/m)
|
player_response = body.match(/(window\["ytInitialPlayerResponse"\]|var\sytInitialPlayerResponse)\s*=\s*(?<info>{.*?});\s*var\s*meta/m)
|
||||||
.try { |r| JSON.parse(r["info"]).as_h }
|
.try { |r| JSON.parse(r["info"]).as_h }
|
||||||
|
|
||||||
if body.includes?("To continue with your YouTube experience, please fill out the form below.") ||
|
if body.includes?("To continue with your YouTube experience, please fill out the form below.") ||
|
||||||
|
Loading…
Reference in New Issue
Block a user