.scq fixed, local soundcloud api keys are no longer used, .scpl fix is coming soon™️
This commit is contained in:
		@@ -431,7 +431,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
 | 
			
		||||
            using (var http = new HttpClient())
 | 
			
		||||
            {
 | 
			
		||||
                var scvids = JObject.Parse(await http.GetStringAsync($"http://api.soundcloud.com/resolve?url={pl}&client_id={_creds.SoundCloudClientId}").ConfigureAwait(false))["tracks"].ToObject<SoundCloudVideo[]>();
 | 
			
		||||
                var scvids = JObject.Parse(await http.GetStringAsync($"http://scapi.nadekobot.me/resolve?url={pl}").ConfigureAwait(false))["tracks"].ToObject<SoundCloudVideo[]>();
 | 
			
		||||
                await _music.QueueSong(((IGuildUser)Context.User), (ITextChannel)Context.Channel, ((IGuildUser)Context.User).VoiceChannel, scvids[0].TrackLink).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                MusicPlayer musicPlayer;
 | 
			
		||||
@@ -446,7 +446,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                        {
 | 
			
		||||
                            Title = svideo.FullName,
 | 
			
		||||
                            Provider = "SoundCloud",
 | 
			
		||||
                            Uri = svideo.GetStreamLink(_creds),
 | 
			
		||||
                            Uri = await svideo.StreamLink(),
 | 
			
		||||
                            ProviderType = MusicType.Normal,
 | 
			
		||||
                            Query = svideo.TrackLink,
 | 
			
		||||
                        }), ((IGuildUser)Context.User).Username);
 | 
			
		||||
 
 | 
			
		||||
@@ -281,7 +281,7 @@ namespace NadekoBot.Services.Music
 | 
			
		||||
                    {
 | 
			
		||||
                        Title = svideo.FullName,
 | 
			
		||||
                        Provider = "SoundCloud",
 | 
			
		||||
                        Uri = svideo.GetStreamLink(_creds),
 | 
			
		||||
                        Uri = await svideo.StreamLink(),
 | 
			
		||||
                        ProviderType = musicType,
 | 
			
		||||
                        Query = svideo.TrackLink,
 | 
			
		||||
                        AlbumArt = svideo.artwork_url,
 | 
			
		||||
@@ -296,7 +296,7 @@ namespace NadekoBot.Services.Music
 | 
			
		||||
                    {
 | 
			
		||||
                        Title = svideo.FullName,
 | 
			
		||||
                        Provider = "SoundCloud",
 | 
			
		||||
                        Uri = svideo.GetStreamLink(_creds),
 | 
			
		||||
                        Uri = await svideo.StreamLink(),
 | 
			
		||||
                        ProviderType = MusicType.Soundcloud,
 | 
			
		||||
                        Query = svideo.TrackLink,
 | 
			
		||||
                        AlbumArt = svideo.artwork_url,
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ namespace NadekoBot.Services.Music
 | 
			
		||||
 | 
			
		||||
            using (var http = new HttpClient())
 | 
			
		||||
            {
 | 
			
		||||
                response = await http.GetStringAsync($"http://api.soundcloud.com/resolve?url={url}&client_id={_creds.SoundCloudClientId}").ConfigureAwait(false);
 | 
			
		||||
                response = await http.GetStringAsync($"https://scapi.nadekobot.me/resolve?url={url}").ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
@@ -50,7 +50,7 @@ namespace NadekoBot.Services.Music
 | 
			
		||||
            var response = "";
 | 
			
		||||
            using (var http = new HttpClient())
 | 
			
		||||
            {
 | 
			
		||||
                response = await http.GetStringAsync($"http://api.soundcloud.com/tracks?q={Uri.EscapeDataString(query)}&client_id={_creds.SoundCloudClientId}").ConfigureAwait(false);
 | 
			
		||||
                response = await http.GetStringAsync($"https://scapi.nadekobot.me/tracks?q={Uri.EscapeDataString(query)}").ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var responseObj = JsonConvert.DeserializeObject<SoundCloudVideo[]>(response).Where(s => s.Streamable).FirstOrDefault();
 | 
			
		||||
@@ -74,7 +74,13 @@ namespace NadekoBot.Services.Music
 | 
			
		||||
        [JsonProperty("permalink_url")]
 | 
			
		||||
        public string TrackLink { get; set; } = "";
 | 
			
		||||
        public string artwork_url { get; set; } = "";
 | 
			
		||||
        public string GetStreamLink(IBotCredentials creds) => $"https://api.soundcloud.com/tracks/{Id}/stream?client_id={creds.SoundCloudClientId}";
 | 
			
		||||
        public async Task<string> StreamLink()
 | 
			
		||||
        {
 | 
			
		||||
            using (var http = new HttpClient())
 | 
			
		||||
            {
 | 
			
		||||
                return await http.GetStringAsync($"http://scapi.nadekobot.me/stream/{Id}");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    public class SoundCloudUser
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user