iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.49k stars 1.86k forks source link

[Bug] While trying to play a video: Expected Hash for #[]?(key : String), not String (Exception) #2549

Closed ligix closed 3 years ago

ligix commented 3 years ago

Describe the bug When you open a video, it shows an error instead of playing the video

Steps to Reproduce

  1. Open https://redirect.invidious.io/watch?v=l3C8VRFDItk
  2. An error is shown instead of the video (Tested with yewtu.be and inv.riverside.rocks)

Logs Title: Expected Hash for #[]?(key : String), not String (Exception) Date: 2021-10-30T14:15:34Z Route: /watch?v=l3C8VRFDItk Version: 2021.10.26-6a15b0b @ master

Backtrace

``` Expected Hash for #[]?(key : String), not String (Exception) from src/invidious/yt_backend/extractors.cr:435:0 in '[]?' from src/invidious/videos.cr:577:47 in 'fmt_stream' from src/invidious/routes/watch.cr:127:18 in 'handle' from lib/kemal/src/kemal/route.cr:13:9 in '->' from /usr/lib/crystal/core/primitives.cr:266:3 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from src/invidious/helpers/static_file_handler.cr:167:15 in 'call' from lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call' from /usr/lib/crystal/core/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/lib/crystal/core/http/server.cr:500:5 in '->' from /usr/lib/crystal/core/primitives.cr:266:3 in 'run' from /src/boringssl/src/google-boringssl-251b516/ssl/internal.h:334:8 in '???' ```

Additional context

ligix commented 3 years ago

Also embeds doesn't seem to be available (https://youtube[dot]com/embed/l3C8VRFDItk).

screenshot

SamantazFox commented 3 years ago

Thanks for your report !

After a quick investigation, it seems that this video is available on the web client, but not on Android, so the check made on params["reason"] can't catch it because there are no reason given: https://github.com/iv-org/invidious/blob/2b81a82620cee3c1dac3c9b314f37dc2f8ac3086/src/invidious/videos.cr#L852-L863

JSON output with Android client ``` { "playabilityStatus": { "status": "UNPLAYABLE", "reason": "This video is not available", "errorScreen": { "playerErrorMessageRenderer": { "reason": { "runs": [ { "text": "This video is not available" } ] }, "thumbnail": { "thumbnails": [ { "url": "//s.ytimg.com/yts/img/meh7-vflGevej7.png", "width": 140, "height": 100 } ] } } }, "contextParams": "Q0FFU0FnZ0I=" }, "videoDetails": { "videoId": "l3C8VRFDItk", "title": "Tower of Terror Full Lobby Music Loop (Fixed Audio Version)", "lengthSeconds": "3646", "keywords": [ "the disneyland forever project", "disneyland", "disney", "mickey mouse", "carousel of progress", "Walt Disney's Carousel Of Progress (Disney Ride)", "Carousel (Amusement Ride)", "Walt Disney (Author)", "Silly Symphonies (Film Series)", "Silly Symphony Swings (Disney Ride)", "Mouse", "music", "download", "california adventure", "Soundtrack", "Swing Ride", "The Twilight Zone Tower Of Terror (Disney Ride)", "Disney Channel (TV Network)", "themeparkaudios", "HD" ], "channelId": "UCCKck4pLmIv78PDwc0ONvwQ", "isOwnerViewing": false, "shortDescription": "This is a re-upload of the original video posted here: https://www.youtube.com/watch?v=V2IItVL0Fn4\nThis video has fixed audio for a few bits in the original upload that did not render properly. \n\nThis is the loop of the music that plays in the lobby of Tower of Terror at California Adventure, Disneyland Paris, Hollywood Studios, Tokyo Disney, and WDW. \n\nAll rights belong to their respective owners.\nNew Facebook Page: https://www.facebook.com/SuperHotLarry\nSubscribe for more!", "isCrawlable": true, "thumbnail": { "thumbnails": [ { "url": "https://i.ytimg.com/vi_webp/l3C8VRFDItk/default.webp", "width": 120, "height": 90 }, { "url": "https://i.ytimg.com/vi_webp/l3C8VRFDItk/mqdefault.webp", "width": 320, "height": 180 }, { "url": "https://i.ytimg.com/vi_webp/l3C8VRFDItk/hqdefault.webp", "width": 480, "height": 360 }, { "url": "https://i.ytimg.com/vi_webp/l3C8VRFDItk/sddefault.webp", "width": 640, "height": 480 } ] }, "averageRating": 4.970968, "allowRatings": true, "viewCount": "409076", "author": "SuperHotLarry", "isPrivate": false, "isUnpluggedCorpus": false, "isLiveContent": false }, "playerSettingsMenuData": { "loggingDirectives": { "visibility": { "types": "12" } } } } ```
TheFrenchGhosty commented 3 years ago

A 20$ bounty has been added to this issue.

Anyone opening a PR fixing this issue, will receive 20$ (in BTC) from the Invidious project.

More details: #1898