File tree Expand file tree Collapse file tree
CmdPalWebSearchShortcut/WebSearchShortcut Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ private static List<WebSearchShortcutDataEntry> GetDefaultEntries()
9393 new WebSearchShortcutDataEntry
9494 {
9595 Name = "Wikipedia" ,
96- Url = "https://en.wikipedia.org/w/index.php?search=" ,
96+ Url = "https://en.wikipedia.org/w/index.php?fulltext=1& search=%s " ,
9797 SuggestionProvider = "Wikipedia" ,
9898 // HideWhenEmptyQuery = true
9999 } ,
Original file line number Diff line number Diff line change @@ -14,13 +14,19 @@ internal sealed class Wikipedia : ISuggestionsProvider
1414{
1515 public string Name => "Wikipedia" ;
1616
17- private HttpClient Http { get ; } = new HttpClient ( ) ;
17+ private HttpClient Http { get ; }
18+
19+ public Wikipedia ( )
20+ {
21+ Http = new HttpClient ( ) ;
22+ Http . DefaultRequestHeaders . UserAgent . ParseAdd ( "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" ) ;
23+ }
1824
1925 public async Task < IReadOnlyList < Suggestion > > GetSuggestionsAsync ( string query , CancellationToken cancellationToken = default )
2026 {
2127 try
2228 {
23- const string api = "https://api.wikimedia .org/core/ v1/wikipedia/en/ search/title?q=" ;
29+ const string api = "https://en.wikipedia .org/w/rest.php/ v1/search/title?limit=10& q=" ;
2430
2531 await using var resultStream = await Http
2632 . GetStreamAsync ( api + Uri . EscapeDataString ( query ) , cancellationToken )
You can’t perform that action at this time.
0 commit comments