Esempio n. 1
0
        public static async ValueTask <string> SearchGeniusAsync(string author, string title)
        {
            author = author.Replace(' ', '-');
            title  = title.Replace(' ', '-');

            var url   = $"https://genius.com/{author}-{title}-lyrics";
            var bytes = await GetBytesAsync(url)
                        .ConfigureAwait(false);

            return(VictoriaExtensions.ParseGeniusHtml(bytes));
        }
Esempio n. 2
0
        /// <summary>
        /// Searches Genius for lyrics and returns them as string.
        /// </summary>
        /// <param name="lavaTrack"><see cref="LavaTrack"/></param>
        /// <returns><see cref="string"/></returns>
        /// <exception cref="ArgumentNullException">Throws if LavaTrack is null.</exception>
        public static async ValueTask <string> SearchGeniusAsync(LavaTrack lavaTrack)
        {
            if (lavaTrack == null)
            {
                throw new ArgumentNullException(nameof(lavaTrack));
            }

            var(author, title) = lavaTrack.GetAuthorAndTitle();
            author             = author.Replace(' ', '-');
            title = title.Replace(' ', '-');

            var url   = $"https://genius.com/{author}-{title}-lyrics";
            var bytes = await GetBytesAsync(url)
                        .ConfigureAwait(false);

            return(VictoriaExtensions.ParseGeniusHtml(bytes));
        }
Esempio n. 3
0
        /// <summary>
        /// Searches Genius for lyrics and returns them as string.
        /// </summary>
        /// <param name="lavaTrack"><see cref="LavaTrack"/></param>
        /// <returns><see cref="string"/></returns>
        /// <exception cref="ArgumentNullException">Throws if LavaTrack is null.</exception>
        public static async ValueTask <string> SearchGeniusAsync(LavaTrack lavaTrack)
        {
            if (lavaTrack == null)
            {
                throw new ArgumentNullException(nameof(lavaTrack));
            }

            var(author, title) = lavaTrack.GetAuthorAndTitle();
            //Phytal - added regex to improve lyric finding
            Regex x = new Regex(@"\[\D+\]");

            title  = x.Replace(title, "").Trim();
            author = author.Trim();
            //
            author = author.Replace(' ', '-');
            title  = title.Replace(' ', '-');

            var url   = $"https://genius.com/{author}-{title}-lyrics";
            var bytes = await GetBytesAsync(url)
                        .ConfigureAwait(false);

            return(VictoriaExtensions.ParseGeniusHtml(bytes));
        }