diff options
| author | syeopite <syeopite@syeopite.dev> | 2021-06-27 07:18:16 -0700 |
|---|---|---|
| committer | syeopite <syeopite@syeopite.dev> | 2021-06-27 08:35:28 -0700 |
| commit | 54b19a04bb11292634d5275ee25622f048212330 (patch) | |
| tree | 55011dec2840086357fa84f1c65cfcfb32b70da4 /src/invidious.cr | |
| parent | ca4df2967049ca8557506706e384d7ceab3f67a8 (diff) | |
| download | invidious-54b19a04bb11292634d5275ee25622f048212330.tar.gz invidious-54b19a04bb11292634d5275ee25622f048212330.tar.bz2 invidious-54b19a04bb11292634d5275ee25622f048212330.zip | |
Fix caption parsing on age restricted videos
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index f7c8980a..57809c0b 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1961,9 +1961,9 @@ get "/api/v1/captions/:id" do |env| json.array do captions.each do |caption| json.object do - json.field "label", caption.name.simpleText + json.field "label", caption.name json.field "languageCode", caption.languageCode - json.field "url", "/api/v1/captions/#{id}?label=#{URI.encode_www_form(caption.name.simpleText)}" + json.field "url", "/api/v1/captions/#{id}?label=#{URI.encode_www_form(caption.name)}" end end end @@ -1979,7 +1979,7 @@ get "/api/v1/captions/:id" do |env| if lang caption = captions.select { |caption| caption.languageCode == lang } else - caption = captions.select { |caption| caption.name.simpleText == label } + caption = captions.select { |caption| caption.name == label } end if caption.empty? @@ -1993,7 +1993,7 @@ get "/api/v1/captions/:id" do |env| # Auto-generated captions often have cues that aren't aligned properly with the video, # as well as some other markup that makes it cumbersome, so we try to fix that here - if caption.name.simpleText.includes? "auto-generated" + if caption.name.includes? "auto-generated" caption_xml = YT_POOL.client &.get(url).body caption_xml = XML.parse(caption_xml) |
