public static string By_VerificationCode(string ClientID, string Scope = null) { string URL = "https://www.dailymotion.com/oauth/authorize"; var parameters = new Dictionary <string, string>(); parameters.Add("response_type", ResponseType.code.ToString()); parameters.Add("client_id", ClientID); parameters.Add("redirect_uri", "https://unlimitedillegal.altervista.org/Dailymotion/app.html"); parameters.Add("display", "popup"); parameters.Add("scope", Scope); return(URL + Utilitiez.AsQueryString(parameters)); }
public async Task <JSON_UserMetadata> UserInfo() { var parameters = new Dictionary <string, string>() { { "fields", string.Join(",", Utilitiez.GetStringsFromClassConstants(typeof(Utilitiez.FieldsUsers))) } }; // parameters.Add("fields", String.Join(",", utilitiez.GetStringsFromClassConstants(GetType(utilitiez.FieldsUsers)))) ' "created_time,email,fullname,limits,status,url,verified,videos_total,views_total,playlists_total") using (HtpClient localHttpClient = new HtpClient(new HCHandler())) { HttpRequestMessage HtpReqMessage = new HttpRequestMessage(HttpMethod.Post, new pUri("/user/me", parameters)); HttpResponseMessage ResPonse = await localHttpClient.SendAsync(HtpReqMessage, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false); string result = await ResPonse.Content.ReadAsStringAsync(); return(ResPonse.IsSuccessStatusCode ? JsonConvert.DeserializeObject <JSON_UserMetadata>(result, JSONhandler) : throw ShowError(result)); } }
public async Task <JSON_Youtube> GetYoutubeDownloadUrls(string YoutubeVideoUrl) { using (HtpClient localHttpClient = new HtpClient(new HCHandler())) { HttpResponseMessage ResPonse = await localHttpClient.GetAsync(new Uri(string.Format("https://www.youtube.com/get_video_info?video_id={0}&el=embedded&ps=default&eurl=&gl=US&hl=en", Utilitiez.TryParseVideoId(YoutubeVideoUrl)))).ConfigureAwait(false); var result = await ResPonse.Content.ReadAsStringAsync(); if (ResPonse.IsSuccessStatusCode) { result = WebUtility.UrlDecode(result); var theTxt = string.Concat(Utilitiez.Between(result, "player_response=", "}}}&"), "}}}"); return(JsonConvert.DeserializeObject <JSON_Youtube>(theTxt, JSONhandler)); } else { ShowError(result); return(null); } } }
public async Task <JSON_Vimeo> GetVimeoDownloadUrls(string VimeoVideoUrl) { using (HtpClient localHttpClient = new HtpClient(new HCHandler())) { HttpResponseMessage ResPonse = await localHttpClient.GetAsync(new Uri(string.Format("https://player.vimeo.com/video/{0}/config", VimeoVideoUrl.Split('/').Last()))).ConfigureAwait(false); var result = await ResPonse.Content.ReadAsStringAsync(); if (ResPonse.IsSuccessStatusCode) { var fin = JsonConvert.DeserializeObject <JSON_Vimeo>(result, JSONhandler); foreach (var vid in fin.request.files.progressive) { vid.Size_str = await Utilitiez.GetFileSize(vid.url); } return(fin); } else { ShowError(result); return(null); } } }
public static async Task <JSON_ExchangingVerificationCodeForToken> ExchangingVerificationCode_For_Token(string AuthorizationCode, string ClientID, string ClientSecret) { string URL = "https://www.dailymotion.com/oauth/authorize"; var parameters = new Dictionary <string, string>(); parameters.Add("grant_type", ResponseType.authorization_code.ToString()); parameters.Add("client_id", ClientID); parameters.Add("client_secret", ClientSecret); parameters.Add("redirect_uri", "https://unlimitedillegal.altervista.org/Dailymotion/app.html"); parameters.Add("code", AuthorizationCode); using (HtpClient localHttpClient = new HtpClient(new HCHandler())) { var HtpReqMessage = new HttpRequestMessage(HttpMethod.Post, new Uri(URL + Utilitiez.AsQueryString(parameters))); using (HttpResponseMessage response = await localHttpClient.SendAsync(HtpReqMessage, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false)) { string result = await response.Content.ReadAsStringAsync(); var TheRsult = JsonConvert.DeserializeObject <JSON_ExchangingVerificationCodeForToken>(result, JSONhandler); if (response.IsSuccessStatusCode) { return(TheRsult); } else { throw new DailymotionException(TheRsult._ErrorMessage, (int)response.StatusCode); } } } }
public pUri(string ApiAction, Dictionary <string, string> Parameters) : base(APIbase + ApiAction + Utilitiez.AsQueryString(Parameters)) { }