public static string GetClipsRequest(CourseRpc course, Module module, int clipIndex) => $"{{\"query\": " + $"\"query viewClip {{" + $"viewClip (input: " + $"{{author: \\\"{course.GetAuthorNameId(module.AuthorId)}\\\", " + $"clipIndex: {clipIndex}, " + $"courseName: \\\"{course.Name}\\\", " + $"includeCaptions: {course.CourseHasCaptions.ToString().ToLowerInvariant()}, locale: \\\"en\\\", " + $"mediaType: \\\"mp4\\\", " + $"moduleName: \\\"{module.Name}\\\", " + $"quality: \\\"{(course.SupportsWideScreenVideoFormats ? Properties.Settings.Default.Resolution1280x720 : Properties.Settings.Default.Resolution1024x768)}\\\"}}) " + $"{{urls {{url cdn rank source}}, status}}}}\", " + $"\"variables\": {{}}}}";
private async Task <RpcData> GetDeserialisedRpcData(string rpcUri, string productId, CancellationToken token) { var httpHelper = new HttpHelper { AcceptHeader = AcceptHeader.JsonTextPlain, AcceptEncoding = string.Empty, ContentType = ContentType.AppJsonUtf8, Cookies = Cookies, Referrer = new Uri($"https://{Properties.Settings.Default.SiteHostName}"), UserAgent = _userAgent }; var courseRespone = await httpHelper.SendRequest(HttpMethod.Get, new Uri($"https://app.pluralsight.com/learner/content/courses/{productId}"), "", Properties.Settings.Default.RetryOnRequestFailureCount, token); CourseRpc courseRpc = JsonConvert.DeserializeObject <CourseRpc>(courseRespone.Content); var graphQlRequest = GraphQl.GetCourseExtraInfoRequest(productId); var extraInfoResponse = await httpHelper.SendRequest(HttpMethod.Post, new Uri($"https://{Properties.Settings.Default.SiteHostName}/player/api/graphql"), graphQlRequest, Properties.Settings.Default.RetryOnRequestFailureCount, token); dynamic courseExtraInfo = JsonConvert.DeserializeObject <ExpandoObject>(extraInfoResponse.Content, new ExpandoObjectConverter()); courseRpc.CourseHasCaptions = courseExtraInfo.data.rpc.bootstrapPlayer.extraInfo.courseHasCaptions; courseRpc.SupportsWideScreenVideoFormats = courseExtraInfo.data.rpc.bootstrapPlayer.extraInfo.supportsWideScreenVideoFormats; courseRpc.Modules.ToList().ForEach(m => m.Name = m.Id?.Substring(m.Id.LastIndexOf('|') + 1)); var r = new RpcData { Payload = new PayloadRpc { Course = courseRpc } }; return(r); }