Search
Two ways to search
There are two way to perform search on site within the component: using search popup window (menu View Youtube Source Search on Site
) and using Search (Integrated)
UI element.
Auto-completion in search edit box can be turned off using option Search Enable autocomplete in search query edit box
.
Search (Integrated) UIE sends results directly to foobar2000 playlists. How and where exactly they are added is controlled by options from Destination
group.
Search popup window has list control where results are added. Then you can send selected items from this list to foobar2000 playlist (use context menu to check available options).
This window has option Initial focus to search box
in system menu. When enabled, initial focus is always set to the search box when window appears on the screen. Otherwise focus is restored on the control that had it last time the window was visible.
Search config
Anchor of search config is Provider
group. All options after it are options specific to selected provider. Accordingly, all options before this group (i.e. groups Postprocess
and Destination
) provide extra features and do not depend on the selected provider.
Option Limit
tells how many items to retrieve per single search request. It is part of provider config i.e. its maximum value (or whether it is available at all) depends on the selected provider.
Note, it is possible to use playlist URLs instead of search query. In this case options that belong to Provider
group are ignored, but Destination
and Postprocess
will work.
Providers
Currently there are three search providers representing three different ways to search:
youtube.web
. Let's call it "WEB" way. This way component extracts all info from the corresponding web pages.yt-dlp
. This way utilizes the search capabilities provided by yt-dlp.youtube.api
and its derivatives. Let's call them all "API" way. This way uses Youtube Data API to get all the info.
WEB way has the same set of search filters as Youtube website except the ones requiring user authentication and geolocation.
When using yt-dlp, component requests "flat playlist" (option --flat-playlist
) otherwise every video would be analyzed and search would take a lot of time. Some properties in the search results are missing because of this.
API way is represented by four providers: one common (youtube.api
) and three specialized. Specialized providers are reference implementations of Search API with parameters relevant to corresponding resource types (because a lot of parameters there are relevant only for a subset of resource types). And the common one (youtube.api
) is a simplified mix that tries to give the same set of options as the standard search on Youtube site. This is not entirely possible since some options (like search for HDR videos) are not exposed by API.
Summary of differences between the search ways is provided in the following table.
Difference | WEB | yt-dlp | API |
---|---|---|---|
Variety of search filters | High (exclusive: 4K, 360°, VR180, HDR) | Low (only by relevance/date) | Medium |
Search items per page | Fixed (20) | Configurable (1-1000, default: 50) | Configurable (1-50, default: 50) |
Search track for next portion | Yes | No | Yes |
Search results completeness | No likes | No description, upload date, likes | Complete |
Upload date in search results | Relative, approximated (e.g. "5 years ago"), possibly localized | - | Absolute, exact (YYYY-MM-DD) |
View count in search results | Approximated (e.g. "18M" for ~18 million), localized in component language | Exact number | Exact number |
Possibility to break due to internal changes on the site | Yes | Yes (but gets fixed before you notice it) | No |
Destination
This group controls where and how search results are added.
There are three options to select destination playlist: active playlist
, new playlist
and specific playlist
. For the latter you need to specify playlist title, and search results will always be added to this playlist. It will be created if yet does not exist. Otherwise first playlist with specified name will be used as destination.
This group also provides few actions to be performed when adding results to destination playlist.
Option wipe before add
means that destination playlist should be cleared before adding new search results.
If destination playlist already contains some tracks, search results are appended to the end. When option insert in front
is enabled, results are inserted before the existing tracks.
If there are more search results than the number in Limit
option, after the search results in destination playlist will also be added a track representing the next portion of the search. When it is selected to play, it gets replaced by the search results from the next portion and, if there are more results, another track for the next portion. And so on.
If you do not need this "next" track, you can use skip 'next' track
option.
More about this "next" track. If it is played during regular playback (for example previous track ended and it was selected to play next) then the search results will be added to playlist and playback will continue from the first search result. If you want to retrieve next portion without playback interruption use context menu Youtube Source Fetch items
.
Postprocess
This group holds features that are applied to search results after the search is completed.
Action add %tracknumber%
stores index in found tracks as %tracknumber%
metadata field.
Action add playlist meta tags
works only for playlists. When loading playlist items, it adds next metadata fields to each track (using metadata overriding): %playlist_title%, %playlist_url%, %playlist_pos%
.
Search context menu
Subject of this topic is Youtube Source Search
popup menu from the playlist context menu.
The idea is to construct search query basing on the playlist item metadata and search it on the site. Note that original track does not have to be Youtube video. It can be any local audio file or, for example, a currently playing song from the radio station.
Search items are enabled only when there is selected single playlist item. Particular search item is enabled only if the search query for this item will not be empty after processing titleformatting in it.
Existing search items can be configured, as well as new ones can be added, using component preferences Search Context Menu
tab. It has full set of features available in regular search and works the same except that the search query is generated automatically. Use context menu of the list control there to check for available options.
Search replacement
This feature is originally intended for the cases when you have video which is no longer available (due to account termination or any other reason). This command replaces selected track with a search track configured to search for replacement on Youtube and use first search result.
This functionality is placed in Youtube Source
popup menu of the playlist context menu. There are available two variants of the search: auto and manual.
Search query for auto variant is generated using titleformatting. Rule for it can be configured using option Search Pattern for automatic substitution
.
Manual variant does the same but a dialog box appears before substitution where search query can be edited.
Regular (i.e. non-Youtube) playlist items can also be replaced.
Tips for Youtube
Search on Youtube is case insensitive. It is performed in all metadata i.e. not only in the title but also in description, user names, keywords etc.
Search supports several rules to customize search query. They are listed in the table below with an example for every rule and a brief description. Note the number of search results for every rule.
Query | Results | Description |
---|---|---|
wacken | 829844 | Search videos containing word Wacken (case-insensitive). |
wacken -2016 | 541051 | Hyphen before a word excludes videos containing this word from the search results. So this search query means "search videos containing word wacken and not containing word 2016". Note the decrease in the number of results comparing to the previous example. |
wacken 2016 | 188854 | Search videos associated with both search terms. |
"wacken 2016" | 71828 | Search for exact phrase. So for example "Wacken Open Air 2016" will be omitted. Note that phrase should be wrapped in double quotes. If you wrap it for example in single quotes, they will be ignored by the search engine. Also note that when searching by exact phrase, word separators do not matter. For example, search query "one two three" will also match "one, two, three" and "one-two-three". |
wacken | 2016 | 1M+ | Search word Wacken OR word 2016. |
Help Search