mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2025-01-09 02:56:06 +01:00
Parse IV search urls (#3849)
* parse iv search urls * Move removing query params to if
This commit is contained in:
parent
072066fbe1
commit
5fffe83237
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user