parent
74aa85d1e0
commit
8383ff23f3
@ -49,31 +49,30 @@ public class VideoDownloader(IReadOnlyList<Cookie>? initialCookies = null)
|
||||
)
|
||||
{
|
||||
// Include subtitles in the output container
|
||||
var trackInfos =
|
||||
includeSubtitles && !downloadOption.Container.IsAudioOnly
|
||||
? (
|
||||
await _youtube
|
||||
.Videos
|
||||
.ClosedCaptions
|
||||
.GetManifestAsync(video.Id, cancellationToken)
|
||||
).Tracks
|
||||
: Array.Empty<ClosedCaptionTrackInfo>();
|
||||
var trackInfos = new List<ClosedCaptionTrackInfo>();
|
||||
if (includeSubtitles && !downloadOption.Container.IsAudioOnly)
|
||||
{
|
||||
var manifest = await _youtube.Videos.ClosedCaptions.GetManifestAsync(
|
||||
video.Id,
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
trackInfos.AddRange(manifest.Tracks);
|
||||
}
|
||||
|
||||
var dirPath = Path.GetDirectoryName(filePath);
|
||||
if (!string.IsNullOrWhiteSpace(dirPath))
|
||||
Directory.CreateDirectory(dirPath);
|
||||
|
||||
await _youtube
|
||||
.Videos
|
||||
.DownloadAsync(
|
||||
downloadOption.StreamInfos,
|
||||
trackInfos,
|
||||
new ConversionRequestBuilder(filePath)
|
||||
.SetContainer(downloadOption.Container)
|
||||
.SetPreset(ConversionPreset.Medium)
|
||||
.Build(),
|
||||
progress?.ToDoubleBased(),
|
||||
cancellationToken
|
||||
);
|
||||
await _youtube.Videos.DownloadAsync(
|
||||
downloadOption.StreamInfos,
|
||||
trackInfos,
|
||||
new ConversionRequestBuilder(filePath)
|
||||
.SetContainer(downloadOption.Container)
|
||||
.SetPreset(ConversionPreset.Medium)
|
||||
.Build(),
|
||||
progress?.ToDoubleBased(),
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -54,9 +54,10 @@ public class QueryResolver(IReadOnlyList<Cookie>? initialCookies = null)
|
||||
// Channel (by handle)
|
||||
if (isUrl && ChannelHandle.TryParse(query) is { } channelHandle)
|
||||
{
|
||||
var channel = await _youtube
|
||||
.Channels
|
||||
.GetByHandleAsync(channelHandle, cancellationToken);
|
||||
var channel = await _youtube.Channels.GetByHandleAsync(
|
||||
channelHandle,
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
var videos = await _youtube.Channels.GetUploadsAsync(channel.Id, cancellationToken);
|
||||
return new QueryResult(QueryResultKind.Channel, $"Channel: {channel.Title}", videos);
|
||||
@ -81,8 +82,7 @@ public class QueryResolver(IReadOnlyList<Cookie>? initialCookies = null)
|
||||
// Search
|
||||
{
|
||||
var videos = await _youtube
|
||||
.Search
|
||||
.GetVideosAsync(query, cancellationToken)
|
||||
.Search.GetVideosAsync(query, cancellationToken)
|
||||
.CollectAsync(20);
|
||||
|
||||
return new QueryResult(QueryResultKind.Search, $"Search: {query}", videos);
|
||||
|
@ -44,10 +44,10 @@ public class MediaTagInjector
|
||||
video.Title.Contains(r.Title, StringComparison.OrdinalIgnoreCase)
|
||||
&& (
|
||||
video.Title.Contains(r.Artist, StringComparison.OrdinalIgnoreCase)
|
||||
|| video
|
||||
.Author
|
||||
.ChannelTitle
|
||||
.Contains(r.Artist, StringComparison.OrdinalIgnoreCase)
|
||||
|| video.Author.ChannelTitle.Contains(
|
||||
r.Artist,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -72,8 +72,7 @@ public class MediaTagInjector
|
||||
{
|
||||
var thumbnailUrl =
|
||||
video
|
||||
.Thumbnails
|
||||
.Where(
|
||||
.Thumbnails.Where(
|
||||
t =>
|
||||
string.Equals(
|
||||
t.TryGetImageFormat(),
|
||||
|
@ -1,13 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||
<PackageReference Include="Gress" Version="2.1.1" />
|
||||
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
||||
<PackageReference Include="Lazy.Fody" Version="1.11.0" PrivateAssets="all" />
|
||||
<PackageReference Include="TagLibSharp" Version="2.3.0" />
|
||||
<PackageReference Include="YoutubeExplode" Version="6.3.9" />
|
||||
<PackageReference Include="YoutubeExplode.Converter" Version="6.3.9" />
|
||||
<PackageReference Include="YoutubeExplode" Version="6.3.10" />
|
||||
<PackageReference Include="YoutubeExplode.Converter" Version="6.3.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -67,8 +67,7 @@ public partial class SettingsService
|
||||
try
|
||||
{
|
||||
return Registry
|
||||
.CurrentUser
|
||||
.OpenSubKey(
|
||||
.CurrentUser.OpenSubKey(
|
||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||
false
|
||||
)
|
||||
|
@ -12,13 +12,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Cogwheel" Version="2.0.4" />
|
||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
|
||||
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Gress" Version="2.1.1" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2151.40" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2210.55" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
<PackageReference Include="Onova" Version="2.6.10" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user