Esempio n. 1
0
        public string Get_YAnalytics_ChannelId(string channelId, string acctoken, string fromDate, string toDate)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string  accesstoken = objoAuthTokenYoutube.GetAccessToken(acctoken);
            JObject JData       = JObject.Parse(accesstoken);

            accesstoken = JData["access_token"].ToString();

            string RequestUrl = "https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D" + channelId + "&start-date=" + fromDate + "&end-date=" + toDate + "&metrics=subscribersGained%2Cviews%2Clikes%2Ccomments%2Cshares%2Cdislikes%2CsubscribersLost%2CaverageViewDuration%2CestimatedMinutesWatched%2CannotationClickThroughRate%2CannotationCloseRate&dimensions=day%2Cchannel&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.GET.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 2
0
        public string Get_PlaylistItems_List(string accesstoken, string part, string UploadId)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            //string RequestUrl = "https://www.googleapis.com/youtube/v3/playlistItems?part=" + part + "&maxResults=50&playlistId=" + UploadId + "&key=" + accesstoken;
            string RequestUrl = "https://www.googleapis.com/youtube/v3/playlistItems?part=" + part + "&maxResults=50&playlistId=" + UploadId + "&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Authentication.oAuthToken.Method.GET.ToString());
                //if (!response.StartsWith("["))
                //    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 3
0
        public string deletesaComment(string refreshtoken, string commentId)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);
            oAuthToken        objoauth             = new oAuthToken(_clientId, _clientSecret, _redirectUrl);

            string  accesstoken_jdata = objoauth.GetAccessToken(refreshtoken);
            JObject JData             = JObject.Parse(accesstoken_jdata);
            string  accesstoken       = JData["access_token"].ToString();

            string RequestUrl = "https://www.googleapis.com/youtube/v3/comments?id=" + commentId + "&key=" + accesstoken + "&alt=json";


            Uri path = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.DELETE.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }


            return(response);
        }
Esempio n. 4
0
        public string Get_Channel_List_serarch(string accesstoken, string search)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            // string RequestUrl = "https://www.googleapis.com/youtube/v3/channels?part=" + part + "&id=" + Id + "&key=" + accesstoken;
            string RequestUrl = "https://www.googleapis.com/plus/v1/activities?query=salman&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.GET.ToString());
                //if (!response.StartsWith("["))
                //    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 5
0
        public string Get_Activities(string accesstoken, string part, string channelId, int maxResults)
        {
            //https://www.googleapis.com/youtube/v3/activities?part=snippet&channelId=UCBR8-60-B28hp2BmDPdntcQ&maxResults=50&key={YOUR_API_KEY}

            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);


            string RequestUrl = "https://www.googleapis.com/youtube/v3/activities?part=" + part + "&channelId=" + channelId + "&maxResults=" + maxResults + "&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Authentication.oAuthToken.Method.GET.ToString());
                //if (!response.StartsWith("["))
                //    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 6
0
        public string Get_VideoCategories(string accesstoken, string part)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            //https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&hl=en_US&regionCode=IN&key={YOUR_API_KEY}
            string RequestUrl = "https://www.googleapis.com/youtube/v3/videoCategories?part=" + part + "&hl=en_US&regionCode=IN&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.GET.ToString());
                //if (!response.StartsWith("["))
                //    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 7
0
        //Get All Activities
        //
        public string Get_All_Activities(string accesstoken, oAuthTokenYoutube.Parts part, bool mine, int maxResults)
        {
            string RequestUrl = "https://www.googleapis.com/youtube/v3/activities?part=" + part.ToString() + "&mine=" + mine.ToString() + "&maxResults=50&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Authentication.oAuthToken.Method.GET.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 8
0
        public string Get_Video_List(string query, string accesstoken, string part, int maxResults)
        {
            string RequestUrl = "https://www.googleapis.com/youtube/v3/videos?part=" + part + "&chart=mostpopular&maxResults=" + maxResults + "&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, GlobusGooglePlusLib.Authentication.oAuthToken.Method.GET.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 9
0
        //
        public string Get_Channel_List(string accesstoken, string part, int maxResults, bool mine)
        {
            string RequestUrl = "https://www.googleapis.com/youtube/v3/channels?part=" + part + "&mine=" + mine + "&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, GlobusGooglePlusLib.Authentication.oAuthToken.Method.GET.ToString());
                //if (!response.StartsWith("["))
                //    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 10
0
        /// <Get_Subscriptions_List>
        ///
        /// </summary>
        /// <param name="accesstoken">true</param>
        /// <param name="part">snippet</param>
        /// <returns></returns>
        public string Get_Subscriptions_List(string accesstoken, string part)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/subscriptions?part=" + part + "&mine=true&maxResults=50&key=" + accesstoken;
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.GET.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 11
0
        public string Get_VideoRating(string accesstoken, string videoId)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/videos?id=" + videoId + "&key=" + accesstoken + "&part=snippet,statistics&fields=items(id,snippet,statistics)";
            Uri    path       = new Uri(RequestUrl);

            string[] header   = { "Authorization", "X-JavaScript-User-Agent" };
            string[] val      = { "Bearer " + accesstoken, "Google APIs Explorer" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val, Socioboard.GoogleLib.Authentication.oAuthToken.Method.GET.ToString());
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 12
0
        public string GetYTVideoDetailList(string apiKey, string VideoId)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/videos?part=snippet%2Cstatistics%2CcontentDetails%2Cstatus&id=" + VideoId + "&key=" + apiKey;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 13
0
        public string Get_Search_List_Page(string apiKey, string query, string page)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&pageToken=" + page + "&q=" + query + "&key=" + apiKey;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return(response);
        }
Esempio n. 14
0
        public string GetChannelCmntCount(string accesstoken, string ChannelId)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&channelId=" + ChannelId + "&maxResults=100&key=" + accesstoken;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }


            return(response);
        }
Esempio n. 15
0
        public string Get_CommentsRepliesBy_CmParentId(string cmParentId, string key)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/comments?part=snippet&maxResults=100&parentId=" + cmParentId + "&key=" + key;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }


            return(response);
        }
Esempio n. 16
0
        public string Get_Channel_info(string accesstoken)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + accesstoken;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }


            return(response);
        }
Esempio n. 17
0
        //Get All Activities
        //

        public string GetYtVideos(string ChannelId, string ApiKey)
        {
            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(_clientId, _clientSecret, _redirectUrl);

            string RequestUrl = "https://www.googleapis.com/youtube/v3/activities?part=snippet%2CcontentDetails&channelId=" + ChannelId + "&maxResults=50&key=" + ApiKey;

            Uri path = new Uri(RequestUrl);

            string[] header   = { "token_type", "expires_in" };
            string[] val      = { "Bearer", "3600" };
            string   response = string.Empty;

            try
            {
                response = objoAuthTokenYoutube.WebRequestHeader(path, header, val);
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }


            return(response);
        }