revert: remove 'JSON.parse("'

This commit is contained in:
Théo Gaillard 2020-11-26 17:52:16 +01:00
parent 1ba17a0e14
commit b41ca72d2b
No known key found for this signature in database
GPG Key ID: 9C6AAAF893B070FC
1 changed files with 1 additions and 1 deletions

View File

@ -598,7 +598,7 @@ def create_notification_stream(env, topics, connection_channel)
end
def extract_initial_data(body) : Hash(String, JSON::Any)
return JSON.parse(body.match(/(window\["ytInitialData"\]|var\s*ytInitialData)\s*=\s*(?<info>\{.*?\});/m).try &.["info"] || "{}").as_h
return JSON.parse(body.match(/(window\["ytInitialData"\]|var\s*ytInitialData)\s*=\s*(JSON\.parse\(")?(?<info>\{.*?\})("\))?;/m).try &.["info"] || "{}").as_h
end
def proxy_file(response, env)