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] Missing hash key: "toggleButtonRenderer" (KeyError) #3291

Closed CrDevUno closed 2 years ago

CrDevUno commented 2 years ago

Describe the bug

While entering to this URL: https://vid.puffyan.us/latest_version?id=yyktccr5apU&itag=22 after a few attempts, I get a 502 error.

Steps to Reproduce:

  1. In your broswer, go to https://vid.puffyan.us/latest_version?id=yyktccr5apU&itag=22
  2. Wait until a video loads
  3. After a few seconds (if the response is not a video), then, a 502 error will appear, otherwise, a screen with technical details will show - see screenshot bellow.

Log:

Title: Missing hash key: "toggleButtonRenderer" (KeyError) Date: 2022-08-30T22:39:31Z Route: /latest_version?id=yyktccr5apU&itag=22 Version: 2022.08.13-9e58bc19 @ (HEAD detached at 9e58bc19)

Backtrace (toggle to expand)

``` Missing hash key: "toggleButtonRenderer" (KeyError) from /usr/share/crystal/src/hash.cr:1080:9 in '[]' from /usr/share/crystal/src/json/any.cr:139:5 in 'parse_video_info' from src/invidious/videos.cr:922:12 in 'extract_video_info:video_id' from src/invidious/videos.cr:1121:10 in 'fetch_video' from src/invidious/videos.cr:1101:17 in 'get_video:region' from src/invidious/routes/video_playback.cr:269:15 in 'latest_version' from lib/kemal/src/kemal/route.cr:13:9 in '->' from src/invidious/helpers/handlers.cr:30:37 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from src/ext/kemal_static_file_handler.cr:167:15 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call' from /usr/share/crystal/src/http/server/handler.cr:28:7 in 'call_next' from lib/kemal/src/kemal/init_handler.cr:12:7 in 'process' from /usr/share/crystal/src/http/server.cr:500:5 in '->' from /usr/share/crystal/src/fiber.cr:146:11 in 'run' from ??? ```

Screenshots:

Technical information appears (if no video is loaded or 502 error screen wont show):

Screenshot log details

Additional context

unixfox commented 2 years ago

502 is just that the server can't keep up with the huge number of users on the instance.

About the toggleButtonRenderer error, it's strange because I can't reproduce it on https://vid.puffyan.us instance.

Please try to see if you can reproduce the issue on other instances: https://instances.invidious.io

CrDevUno commented 2 years ago

502 is just that the server can't keep up with the huge number of users on the instance.

About the toggleButtonRenderer error, it's strange because I can't reproduce it on https://vid.puffyan.us instance.

Please try to see if you can reproduce the issue on other instances: https://instances.invidious.io

I tried with other instance (those are available here), but, the videos does not load at all in any of the available instances.

This is strange, due to this issue raised yesterday (30/08/2022) and before this date, the initial link worked without delays.

The health of (vid.puffyan.us) is 48 - I'm not familiar with the instances, but, this tells me there is a problem with the instance itself.

(For clarify), I'm not making multiple requests or abusing the system somehow. I enter to the instances manually.

Example: If set this url in the browser and wait until the video is loaded:

https://vid.puffyan.us/latest_version?id=&itag=22

It could be possible that the delay/issue is due to some firewall protection/rule, by any chance?

Also, I'm getting the 504 Gateway Time-out error more often. This is definitely an instance issue.

unixfox commented 2 years ago

You are linking two different videos, one yyktccr5apU and the other -MG-E8R8aE4 which doesn't work.

As you can see, it works fine for the first video on the most popular instance: https://yewtu.be/latest_version?id=yyktccr5apU&itag=22

SamantazFox commented 2 years ago

It's very likely what @TiA4f8R reported on matrix: Youtube A/B testing a new structure for the likes button.

EDIT: See https://github.com/TeamNewPipe/NewPipeExtractor/pull/926

Here's an extract here:

"videoActions": {
  "menuRenderer": {
    "items": [ ... ],
    "topLevelButtons": [
      {
        "segmentedLikeDislikeButtonRenderer": {
          "likeButton": {
            "toggleButtonRenderer": {
              "style": {
                "styleType": "STYLE_TEXT"
              },
              "isToggled": false,
              "isDisabled": false,
              "defaultIcon": {
                "iconType": "LIKE"
              },
              "defaultText": {
                "accessibility": {
                  "accessibilityData": {
                    "label": "10 394 clics sur \"J'aime\""
                  }
                },
                "simpleText": "10 k"
              },
              "toggledText": {
                "accessibility": {
                  "accessibilityData": {
                    "label": "10 395 clics sur \"J'aime\""
                  }
                },
                "simpleText": "10 k"
              },
              "accessibility": {
                "label": "Cliquez sur \"J'aime\" pour cette vidéo comme 10 394 autres internautes."
              },
              "defaultTooltip": "J'aime ce contenu",
              "toggledTooltip": "Je n'aime plus",
              "toggledStyle": {
                "styleType": "STYLE_DEFAULT_ACTIVE"
              },
              "defaultNavigationEndpoint": { ... },
              "accessibilityData": {
                "accessibilityData": {
                  "label": "Cliquez sur \"J'aime\" pour cette vidéo comme 10 394 autres internautes."
                }
              },
              "toggleButtonSupportedData": {
                "toggleButtonIdData": {
                  "id": "TOGGLE_BUTTON_ID_TYPE_LIKE"
                }
              },
              "targetId": "watch-like"
            }
          },
          "dislikeButton": {
            "toggleButtonRenderer": {
              "style": {
                "styleType": "STYLE_TEXT"
              },
              "isToggled": false,
              "isDisabled": false,
              "defaultIcon": {
                "iconType": "DISLIKE"
              },
              "accessibility": {
                "label": "Je n'aime pas cette vidéo"
              },
              "defaultTooltip": "Je n'aime pas ce contenu",
              "toggledTooltip": "Je n'aime pas ce contenu",
              "toggledStyle": {
                "styleType": "STYLE_DEFAULT_ACTIVE"
              },
              "defaultNavigationEndpoint": { ... },
              "accessibilityData": {
                "accessibilityData": {
                  "label": "Je n'aime pas cette vidéo"
                }
              },
              "toggleButtonSupportedData": {
                "toggleButtonIdData": {
                  "id": "TOGGLE_BUTTON_ID_TYPE_DISLIKE"
                }
              },
              "targetId": "watch-dislike"
            }
          }
        }
      },
      {
        "buttonRenderer": { ... }
      }
    ],
    "accessibility": { ... },
    "flexibleItems": [ ... ]
  }
}
jakubgs commented 2 years ago

I started experiencing this error after I upgraded from unstable-2022-07-10(cbcf31a4f98706ea675cafb7509b37dc2b0ceace) - which I ran for a long time without issues - to unstable-2022-08-13(9e58bc19c4baf7ca7da97c2f8b164789d041d9b8) on NixOS. And it's definitely not related to server load as I'm the only one using it and it has plenty of spare resources.