Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): Update Button #857

Merged
merged 1 commit into from
Dec 31, 2024
Merged

feat(parser): Update Button #857

merged 1 commit into from
Dec 31, 2024

Conversation

jonz94
Copy link
Contributor

@jonz94 jonz94 commented Dec 25, 2024

This PR updates the Button parser:

  • Add style property
  • Add size property
  • Add target_id property
  • Parse data.accessibilityData.accessibilityData.label if data.accessibility.label is unavailable

Example RawNode data 1:

{
  "buttonRenderer": {
    "style": "STYLE_BLUE_TEXT",
    "size": "SIZE_DEFAULT",
    "isDisabled": false,
    "text": {
      "simpleText": "Learn more"
    },
    "navigationEndpoint": {
      "clickTrackingParams": "CB8Q8FsiEwiE3dTgramKAxXD1UwCHcXaFsg=",
      "commandMetadata": {
        "webCommandMetadata": {
          "url": "//support.google.com/youtube/?p=subs_only_chat_viewer&hl=en",
          "webPageType": "WEB_PAGE_TYPE_UNKNOWN",
          "rootVe": 83769
        }
      },
      "urlEndpoint": {
        "url": "//support.google.com/youtube/?p=subs_only_chat_viewer&hl=en",
        "target": "TARGET_NEW_WINDOW"
      }
    },
    "trackingParams": "CB8Q8FsiEwiE3dTgramKAxXD1UwCHcXaFsg=",
    "accessibilityData": {
      "accessibilityData": {
        "label": "Learn more"
      }
    }
  }
}

Example RawNode data 2:

{
  "buttonRenderer": {
    "style": "STYLE_DEFAULT",
    "size": "SIZE_DEFAULT",
    "isDisabled": false,
    "text": {
      "runs": [
        {
          "text": "Go now"
        }
      ]
    },
    "command": {
      "commandMetadata": {
        "webCommandMetadata": {
          "url": "/watch?v=U9xhA27lySE",
          "webPageType": "WEB_PAGE_TYPE_WATCH",
          "rootVe": 3832
        }
      },
      "watchEndpoint": {
        "videoId": "U9xhA27lySE"
      }
    }
  }
}

Example RawNode data 3:

{
  "buttonRenderer": {
    "style": "STYLE_PRIMARY",
    "size": "SIZE_DEFAULT",
    "isDisabled": false,
    "text": {
      "runs": [
        {
          "text": "Got it"
        }
      ]
    },
    "accessibility": {
      "label": "Got it"
    },
    "tooltip": "Got it",
    "trackingParams": "CDQQ8FsiEwjujqzBusWJAxUrrFYBHVfDOn8=",
    "accessibilityData": {
      "accessibilityData": {
        "label": "Got it"
      }
    }
  }
}

Example RawNode data 4:

{
  "buttonRenderer": {
    "style": "STYLE_MONO_FILLED",
    "size": "SIZE_DEFAULT",
    "isDisabled": false,
    "text": {
      "simpleText": "Got it"
    },
    "trackingParams": "CEkQ8FsiEwiQlJ7Zt76JAxXruFYBHb4hGR0=",
    "accessibilityData": {
      "accessibilityData": {
        "label": "Got it"
      }
    }
  }
}

Example RawNode data 5:

{
  "buttonRenderer": {
    "icon": {
      "iconType": "MORE_VERT"
    },
    "accessibility": {
      "label": "Chat actions"
    },
    "accessibilityData": {
      "accessibilityData": {
        "label": "Chat actions"
      }
    },
    "targetId": "live-chat-action-panel-poll-context-menu",
    "command": {
      "commandMetadata": {
        "webCommandMetadata": {
          "ignoreNavigation": true
        }
      },
      "liveChatItemContextMenuEndpoint": {
        "params": "Q2g0S0hBb2FRMGx0ZVRsa1IzVnhiMjlFUmxSWVJIZG5VV1J3ZGpnd1NHY2FLU29uQ2hoVlEzSjVZMFIyTVhOWlZrZElOVWRMT0ZoQ1ZGaEJRbWNTQ3psblZVdzNNakZxY0dOQklBRW9CRElhQ2hoVlEzSjVZMFIyTVhOWlZrZElOVWRMT0ZoQ1ZGaEJRbWM0QTBnQVVCVSUzRA=="
      }
    }
  }
}

* Add `style` property
* Add `size` property
* Add `target_id` property
* Parse `data.accessibilityData.accessibilityData.label` if `data.accessibility.label` is unavailable
@LuanRT LuanRT merged commit 5f899fc into LuanRT:main Dec 31, 2024
4 checks passed
@jonz94 jonz94 deleted the update-Button branch December 31, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants