mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-14 00:06:52 +01:00
minor fixes to query size and naming
This commit is contained in:
@@ -24,7 +24,7 @@ internal sealed partial class YouTubeChannelVideosPage : DynamicListPage
|
||||
public YouTubeChannelVideosPage(string channelId = null, string channelName = null)
|
||||
{
|
||||
Icon = new("https://www.youtube.com/favicon.ico");
|
||||
Name = $"YouTube ({channelName ?? "Channel Video Search"})";
|
||||
Name = $"YouTube (Video Search) - {channelName ?? "Channel Video Search"}";
|
||||
this.ShowDetails = true;
|
||||
|
||||
// Ensure either a ChannelId or ChannelName is provided
|
||||
@@ -97,12 +97,12 @@ internal sealed partial class YouTubeChannelVideosPage : DynamicListPage
|
||||
if (!string.IsNullOrEmpty(channelId))
|
||||
{
|
||||
// If ChannelId is provided, filter by channelId
|
||||
requestUrl = $"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&channelId={channelId}&q={query}&key={apiKey}&maxResults=10";
|
||||
requestUrl = $"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&channelId={channelId}&q={query}&key={apiKey}&maxResults=20";
|
||||
}
|
||||
else
|
||||
{
|
||||
// If ChannelName is provided, search by the channel name
|
||||
requestUrl = $"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&q={query}+{channelName}&key={apiKey}&maxResults=10";
|
||||
requestUrl = $"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&q={query}+{channelName}&key={apiKey}&maxResults=20";
|
||||
}
|
||||
|
||||
// Send the request to the YouTube API
|
||||
|
||||
@@ -51,7 +51,7 @@ internal sealed partial class YouTubeChannelsPage : DynamicListPage
|
||||
},
|
||||
MoreCommands = [
|
||||
new CommandContextItem(new YouTubeChannelInfoMarkdownPage(channel)),
|
||||
new CommandContextItem(new YouTubeChannelVideosPage(channel.ChannelId, channel.Name)),
|
||||
new CommandContextItem(new YouTubeChannelVideosPage(channel.ChannelId, channel.Name) { Title = $"Search for Videos by {channel.Name}" }),
|
||||
new CommandContextItem(new YouTubeAPIPage()),
|
||||
],
|
||||
}).ToArray(),
|
||||
@@ -74,7 +74,7 @@ internal sealed partial class YouTubeChannelsPage : DynamicListPage
|
||||
try
|
||||
{
|
||||
// Send the request to the YouTube API with the provided query to search for channels
|
||||
var response = await client.GetStringAsync($"https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q={query}&key={apiKey}&maxResults=5");
|
||||
var response = await client.GetStringAsync($"https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q={query}&key={apiKey}&maxResults=20");
|
||||
var json = JsonNode.Parse(response);
|
||||
|
||||
// Parse the response
|
||||
|
||||
@@ -80,7 +80,7 @@ internal sealed partial class YouTubeVideosPage : DynamicListPage
|
||||
try
|
||||
{
|
||||
// Send the request to the YouTube API with the provided query
|
||||
var response = await client.GetStringAsync($"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&q={query}&key={apiKey}&maxResults=2");
|
||||
var response = await client.GetStringAsync($"https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&q={query}&key={apiKey}&maxResults=20");
|
||||
var json = JsonNode.Parse(response);
|
||||
|
||||
// Parse the response
|
||||
|
||||
Reference in New Issue
Block a user