File tree 3 files changed +4
-17
lines changed
3 files changed +4
-17
lines changed Original file line number Diff line number Diff line change 10
10
11
11
using SpotifyExplode ;
12
12
using SpotifyExplode . Tracks ;
13
- using YoutubeExplode ;
14
- using YoutubeExplode . Videos . Streams ;
15
-
16
13
namespace Nitefox . App . Media ;
17
14
18
15
public class MetadataService
19
16
{
20
17
private readonly SpotifyClient _spotifyClient ;
21
- private readonly YoutubeClient _youtubeClient ;
22
18
23
- public MetadataService ( SpotifyClient spotifyClient , YoutubeClient youtubeClient )
19
+ public MetadataService ( SpotifyClient spotifyClient )
24
20
{
25
21
_spotifyClient = spotifyClient ;
26
- _youtubeClient = youtubeClient ;
27
22
}
28
23
29
24
public async Task < int > GetAlbumTrackCount ( string id )
@@ -88,13 +83,10 @@ public async Task<string> GetPlaylistImageUrl(string id)
88
83
return stream ;
89
84
}
90
85
91
- public async Task < string > GetPreviewStream ( string url )
86
+ public async Task < string ? > GetPreviewStream ( string url )
92
87
{
93
- var youtubeId = await _spotifyClient . Tracks . GetYoutubeIdAsync ( url ) ;
94
- var streamManifest = await _youtubeClient . Videos . Streams . GetManifestAsync ( $ "https://youtube.com/watch?v={ youtubeId } ") ;
95
- return streamManifest . GetAudioOnlyStreams ( )
96
- . OrderByDescending ( stream => stream . Size )
97
- . First ( ) . Url ;
88
+ var previewStream = await _spotifyClient . Tracks . GetDownloadUrlAsync ( url ) ;
89
+ return previewStream ;
98
90
}
99
91
100
92
public async Task < IEnumerable < Track > > GetAlbumTracksMetadata ( string id , string title )
Original file line number Diff line number Diff line change 17
17
<PackageReference Include =" Russkyc.Configuration" Version =" 1.0.1" />
18
18
<PackageReference Include =" SharpCompress" Version =" 0.38.0" />
19
19
<PackageReference Include =" SpotifyExplode" Version =" 1.1.2" />
20
- <PackageReference Include =" YoutubeExplode" Version =" 6.5.0" />
21
20
</ItemGroup >
22
21
23
22
<ItemGroup >
Original file line number Diff line number Diff line change 4
4
using Nitefox . App . Configuration ;
5
5
using Nitefox . App . Ffmpeg ;
6
6
using Nitefox . App . Media ;
7
- using Nitefox . App . Services ;
8
7
using Nitefox . App . States ;
9
- using Nitefox . Client . Shared . Pages ;
10
8
using SpotifyExplode ;
11
- using YoutubeExplode ;
12
9
13
10
namespace Nitefox . Client . Shared
14
11
{
@@ -19,7 +16,6 @@ public static IServiceCollection AddNitefoxServices(this IServiceCollection coll
19
16
return collection . AddSingleton ( _ => new SpotifyClient ( ) )
20
17
. AddMudServices ( )
21
18
. AddMudExtensions ( )
22
- . AddSingleton ( _ => new YoutubeClient ( ) )
23
19
. AddSingleton < SearchState > ( )
24
20
. AddSingleton < NitefoxConfig > ( )
25
21
. AddSingleton < FfmpegService > ( )
You can’t perform that action at this time.
0 commit comments