diff --git a/src/renderer/store/modules/utils.js b/src/renderer/store/modules/utils.js index 3a50dd226..acdf30965 100644 --- a/src/renderer/store/modules/utils.js +++ b/src/renderer/store/modules/utils.js @@ -324,7 +324,7 @@ const actions = { const typePatterns = new Map([ ['playlist', /^(\/playlist\/?|\/embed(\/?videoseries)?)$/], - ['search', /^\/results\/?$/], + ['search', /^\/results|search\/?$/], ['hashtag', hashtagPattern], ['channel', channelPattern] ]) @@ -359,13 +359,21 @@ const actions = { } case 'search': { - if (!url.searchParams.has('search_query')) { + let searchQuery = null + if (url.searchParams.has('search_query')) { + // https://www.youtube.com/results?search_query={QUERY} + searchQuery = url.searchParams.get('search_query') + url.searchParams.delete('search_query') + } + if (url.searchParams.has('q')) { + // https://redirect.invidious.io/search?q={QUERY} + searchQuery = url.searchParams.get('q') + url.searchParams.delete('q') + } + if (searchQuery == null) { throw new Error('Search: "search_query" field not found') } - const searchQuery = url.searchParams.get('search_query') - url.searchParams.delete('search_query') - const searchSettings = state.searchSettings const query = { sortBy: searchSettings.sortBy,