From 5aa2c124729e778815d07b4d5e0bcd7e9a766850 Mon Sep 17 00:00:00 2001 From: Zain Date: Mon, 7 Aug 2023 20:08:18 -0400 Subject: [PATCH] refactor: support old and new payload types --- lib/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 703c216..087afe2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -18,7 +18,11 @@ const DEFAULT_CONTEXT = { exports.parseFilters = json => { const pc = json.contents.twoColumnSearchResultsRenderer.primaryContents; const wrapper = pc.sectionListRenderer || pc.richGridRenderer; - const filterWrapper = (wrapper.subMenu || wrapper.submenu).searchSubMenuRenderer.groups || []; + let filterWrapper = (wrapper.subMenu || wrapper.submenu).searchSubMenuRenderer.groups; + if (filterWrapper === undefined) { + const pc1 = json.header.searchHeaderRenderer.searchFilterButton.buttonRenderer.command.openPopupAction.popup; + filterWrapper = pc1.searchFilterOptionsDialogRenderer.groups || []; + } const parsedGroups = new Map(); for (const filterGroup of filterWrapper) { const singleFilterGroup = new Map();