Skip to content

fix(parser): Add InlineSurvey, ExpandableSurveyResponse, RatingSurvey and RatingSurveyOption - #1318

Open
ChandraChaan wants to merge 1 commit into
LuanRT:mainfrom
ChandraChaan:fix/parser-survey-nodes
Open

ChandraChaan wants to merge 1 commit into
LuanRT:mainfrom
ChandraChaan:fix/parser-survey-nodes

Conversation

@ChandraChaan

Copy link
Copy Markdown

Fixes #1173.

getHomeFeed() can return an inline survey card ("How do you feel about this video?"), and the parser logs four not found! warnings for it (InlineSurvey, ExpandableSurveyResponse, RatingSurvey, RatingSurveyOption) and falls back to JIT-generated classes.

This adds the four classes, following the field shapes in the issue, and registers them in src/parser/nodes.ts in the order gen-parser-map.mjs produces:

  • InlineSurvey: title, subtitle, dismissal_text, inline_content (CompactVideo), response (ExpandableSurveyResponse), dismissal_endpoint, impression_endpoints.
  • ExpandableSurveyResponse: options (RatingSurvey), submit_button.
  • RatingSurvey: ratings (RatingSurveyOption[]), undo_button.
  • RatingSurveyOption: response_text, default_state_icon_type, on_state_icon_type, and follow_up_endpoint / response_endpoint kept separate. The generated class in the issue assigned both commands to the same endpoint field, so the response endpoint overwrote the follow-up command.

This builds on #1186, which added the same nodes but was closed as stale without review. The differences are the separate endpoints above, dismissalEndpoint / impressionEndpoints read only when present, and the current class style (no prototype.type, Parser.parseArray).

How to test: call getHomeFeed() on an account that is shown the survey card; the four warnings no longer appear and the card is available as an InlineSurvey node.

Not verified: I couldn't run npm run lint, tsc or the test suite locally, and I haven't seen the survey card on a live home feed myself. The classes are written against the response shape posted in #1173.

…urvey` and `RatingSurveyOption`

getHomeFeed() can return an inline survey card, and the parser warned that
all four of its nodes were not found and generated classes at runtime.

RatingSurveyOption keeps followUpCommand and responseEndpoint as separate
endpoints instead of the single `endpoint` the generated class assigned
twice.

Fixes LuanRT#1173
@ChandraChaan

Copy link
Copy Markdown
Author

The lint and test workflows here are waiting for approval, so I ran them on my fork and both pass: lint https://github.com/ChandraChaan/YouTube.js/actions/runs/41391258443, test https://github.com/ChandraChaan/YouTube.js/actions/runs/41391258432. Neither runs tspc or parses a survey card, so the classes are checked by ESLint and by loading in the test suite, not against a live response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working parser size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

17.0.1 Four survey-related YTNodes not found by parser

1 participant