diff options
| author | TheFrenchGhosty <47571719+TheFrenchGhosty@users.noreply.github.com> | 2021-05-13 10:24:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-13 10:24:44 +0200 |
| commit | 73da8463caa39757678de04fb23c8015ffd6218c (patch) | |
| tree | 720f16cfac554a37b18595f8632dd9d0535fb3a2 | |
| parent | 62e9e9a66245ea562edda1a32dab28460e609a3e (diff) | |
| parent | 608313c1d1e0f5ec9b4ce9b1d6303f03530656d8 (diff) | |
| download | invidious-73da8463caa39757678de04fb23c8015ffd6218c.tar.gz invidious-73da8463caa39757678de04fb23c8015ffd6218c.tar.bz2 invidious-73da8463caa39757678de04fb23c8015ffd6218c.zip | |
Merge pull request #1953 from syeopite/fix1673
Update regex expressions to handle unexpected '};'
| -rw-r--r-- | src/invidious/helpers/helpers.cr | 2 | ||||
| -rw-r--r-- | src/invidious/videos.cr | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 3767cb50..e9cb3989 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -679,7 +679,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>\{.*?\});/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 def proxy_file(response, env) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 38646311..40d63ae8 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -818,7 +818,7 @@ end def extract_polymer_config(body) 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 } if body.includes?("To continue with your YouTube experience, please fill out the form below.") || |
