public void SoundCloudTracksDownload(string page, SoundCloudTrackFound yield)
        {
            var c = new WebClient();

            var data = c.DownloadString(new Uri(Source + "?page=" + page));

            data.AtIndecies("'player mode medium  {",
                            p =>
            {
                var json_stream = data.Substring(p.i + p.target.Length).TakeUntilIfAny("}'");

                var title = data.Substring(p.i + p.target.Length).SkipUntilIfAny("}'").SkipUntilIfAny("<h3>").SkipUntilIfAny(">").TakeUntilIfAny("<");


                #region get
                YieldValue get = (name, value) =>
                {
                    json_stream.AtIndecies("\"" + name + "\":\"",
                                           s =>
                    {
                        value = json_stream.Substring(s.i + s.target.Length).TakeUntilIfAny("\"");
                    }
                                           );

                    return(value);
                };
                #endregion

                var uid       = get("uid", "");
                var streamUrl = get("streamUrl", "").TakeUntilIfAny("?");
                //var trackName = get("trackName", "");
                var waveformUrl = get("waveformUrl", "");

                yield(uid, streamUrl, title, waveformUrl);
            }
                            );
        }
Example #2
0
 public static dynamic RemoveYield(YieldValue v)
 {
     return v != null ? v.Value : null;
 }
Example #3
0
 public static bool IsYieldValue(YieldValue v)
 {
     return v != null;
 }