Exemplo n.º 1
0
 /// <summary>
 /// this Method Will 
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <returns>Return Xml Text With User Details</returns>
 public XmlDocument Rate_Limit_Status(TwitterUser User)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string response = twtWebReq.PerformWebRequest(User, Globals.RateLimitStatusUrl, "GET", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 } 
Exemplo n.º 2
0
        public List<string> getFriendsofFriends(string FriendId, TwitterUser twitterUser, string goodProxy)
        {
            List<string> followersOfFriend = new List<string>();
            XmlDocument xmlDoc = new XmlDocument();
            TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
            Dictionary<string, string> dic = getUserInfo(twitterUser, FriendId, goodProxy);
            int noofFollowers = Int32.Parse(dic["NoOfFriends"].ToString());
            string FriendIds = "";
            int pageno = 1;
            if (noofFollowers > 5000)
            {
                pageno = noofFollowers / 5000;
                int temp = noofFollowers % 5000;
                if (temp > 10)
                    pageno++;

                FriendIds = twitterWebRequest.PerformWebRequest(twitterUser, Globals.getFriendsUrl + FriendId + ".xml?page=" + pageno, "GET", true, goodProxy);
            }
            else
            {
                FriendIds = twitterWebRequest.PerformWebRequest(twitterUser, Globals.getFriendsUrl + FriendId + ".xml?page=1", "GET", true, goodProxy);
            }

            xmlDoc.Load(new StringReader(FriendIds));
            XmlNodeList xmlNodeList = xmlDoc.GetElementsByTagName("id");
            foreach (XmlNode xmlNode in xmlNodeList)
            {
                followersOfFriend.Add(xmlNode.InnerText.ToString());
            }

            return followersOfFriend;
        }
Exemplo n.º 3
0
 public JObject SearchMethodForTwtUser(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchTwtUserUrl + SearchKey + "&page=" + pageindex;
     JObject response = objTwitterWebRequest.PerformWebRequest(RequestUrl, "GET");
     return response;
 }
Exemplo n.º 4
0
 /// <summary>
 /// This Method Will Check That User is Authenticated Or Not
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <returns>Return Xml Text With User Details</returns>
 public XmlDocument Verify_Credentials(TwitterUser User)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string response = twtWebReq.PerformWebRequest(User, Globals.VerifyCredentialsUrl, "GET", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Get All ReTweets Sent By User
 /// </summary>
 /// <param name="User">Twitter User And Password</param>
 /// <param name="Count">Number Of ReTweets</param>
 /// <returns>Return XmlText Of ReTweets</returns>
 public XmlDocument Status_RetweetedByMe(TwitterUser User, string Count)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.RetweetedByMeUrl + Count;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Get", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 } 
Exemplo n.º 6
0
 /// <summary>
 /// This Method Will Get All Direct Message Sent By User
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <param name="Count">Number Of DirectMessage Sent By User</param>
 /// <returns>Xml Text Of DirectMessage Sent By User</returns>
 public XmlDocument DirectMessage_Sent(TwitterUser User, string Count)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.DirectMessageSentByUserUrl + Count;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Get", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 7
0
 /// <summary>
 /// This Method Will Update Tweets On Twitter
 /// </summary>
 /// <param name="User">Twitter UserName And Password</param>
 /// <param name="StatusText">Status Messages</param>
 /// <returns>Return Xml Text Of Details</returns>
 public XmlDocument UpdateStatus(TwitterUser User, string StatusText)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.UpdateStatusUrl + "?status=" + StatusText;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 8
0
 /// <summary>
 /// This Method Will Show User Statues By ScreenName
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <param name="UserId">Twitter UserId Of User</param>
 /// <returns></returns>
 public XmlDocument ShowStatusByScreenName(TwitterUser User, string ScreenName)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.ShowStatusUrlByScreenName + ScreenName;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Get", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 9
0
 /// <summary>
 /// This Method Will Retweet 
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <param name="UserId">Tweet Id</param>
 /// <returns></returns>
 public XmlDocument ReTweetStatus(TwitterUser User, string Id)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.ReTweetStatus + Id + ".xml";
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 10
0
 /// <summary>
 /// This Method Will Get All Trends Of Twitter
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <returns>Json Text Of Trends</returns>
 public XmlDocument SearchMethod(TwitterUser User, string SearchKey)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchUrl + SearchKey;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Get", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 11
0
 /// <summary>
 /// This Method Will Get All Trends Of Twitter Using OAUTH
 /// </summary>
 /// <param name="User">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Json Text Of Trends</returns>
 public XmlDocument SearchMethod(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchUrl + SearchKey + "&page=" + pageindex; 
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl,string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Follow Twitter User
 /// </summary>
 /// <param name="twitterUser">Twitter UserName And Password</param>
 /// <param name="UserToFollow">ScreenName Of Whom You Want To Follow</param>
 /// <returns>Returm Xml</returns>
 public XmlDocument Friendships_Create(TwitterUser User, string ScreenName)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.FollowerUrl + ScreenName;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 13
0
 /// <summary>
 /// UnFollow Twitter User
 /// </summary>
 /// <param name="twitterUser">Twitter UserName And Password</param>
 /// <param name="UserToFollow">ScreenName Of Whom You Want To UnFollow</param>
 /// <returns>Returm Xml</returns>
 public XmlDocument Friendships_Destroy(TwitterUser User, int UserId)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.UnFollowUrlById + UserId;
     string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
Exemplo n.º 14
0
        /// <summary>
        /// This will Send DirectMessage to the User
        /// </summary>
        /// <param name="User">Twitter UserName Password</param>
        /// <param name="DirectMessage">DirectMessage</param>
        /// <param name="UserId">USerId Whom You Want to Send Direct Message</param>
        /// <returns></returns>
        public XmlDocument NewDirectMessage(TwitterUser User, string DirectMessage, string ScreenName)
        {

            TwitterWebRequest twtWebReq = new TwitterWebRequest();
            string RequestUrl = Globals.NewDirectMessage + "?screen_name=" + ScreenName + "&text=" + DirectMessage;
            string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
            xmlResult.Load(new StringReader(response));
            return xmlResult;
        }
Exemplo n.º 15
0
        /// <summary>
        /// This will Method will delete Direct Message by Direct Message Id
        /// </summary>
        /// <param name="User">Twitter UserName and Password</param>
        /// <param name="DirectMessageId">Direct Message Id</param>
        /// <returns></returns>
        public XmlDocument DeleteDirectMessage(TwitterUser User, int DirectMessageId)
        {

            TwitterWebRequest twtWebReq = new TwitterWebRequest();
            string RequestUrl = Globals.NewDirectMessage + DirectMessageId + ".xml";
            string response = twtWebReq.PerformWebRequest(User, RequestUrl, "Post", true, "");
            xmlResult.Load(new StringReader(response));
            return xmlResult;
        } 
Exemplo n.º 16
0
 public List<string> getFollowers(TwitterUser twitterUser,string goodProxy)
 {
     List<string> followers=new List<string> ();
     XmlDocument xmlDoc = new XmlDocument();
     TwitterWebRequest twitterWebRequest=new TwitterWebRequest();
     string followerIds = twitterWebRequest.PerformWebRequest(twitterUser, Globals.getFollowersUrl + twitterUser.TwitterUserName, "GET", true, goodProxy);
     xmlDoc.Load(new StringReader(followerIds));
     XmlNodeList xmlNodeList = xmlDoc.GetElementsByTagName("id");
     foreach (XmlNode xmlNode in xmlNodeList)
     {
         followers.Add(xmlNode.InnerText.ToString());
     }
     return followers;
 }
Exemplo n.º 17
0
 public  BasicAuth()
 {
     twitterWebRequest = new TwitterWebRequest();
     xmlDoc = new XmlDocument();
 }
Exemplo n.º 18
0
        public Dictionary<string,string> getUserInfo(TwitterUser twitterUser,string userid,string goodProxy)
        {
            
            TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
            Dictionary<string, string> dictUserInfo = new Dictionary<string,string >();
            XmlDocument xmlDoc = new XmlDocument();
            string StatusResponse = twitterWebRequest.PerformWebRequest(twitterUser,Globals.getUserStatusUrl +userid  ,"GET",true,goodProxy  );
            //if (StatusResponse.Contains("404"))
            //{
            //    Logger.LogText("No Such Twitter User Found","");
            //    return dictUserInfo;
            //}
            if (StatusResponse.Contains("400"))
            {
                Logger.LogText("Twitter Returned Bad Request. Please try after some time or use a different machine.");
                return dictUserInfo;
            }

            try
            {
                xmlDoc.Load(new StringReader(StatusResponse));
                XmlNodeList xmlNodeFollowers = xmlDoc.GetElementsByTagName("followers_count");
                string noOfFollowers = xmlNodeFollowers[0].InnerText.ToString();
                dictUserInfo.Add("NoOfFollowers", noOfFollowers);
                XmlNodeList xmlNodeFriends = xmlDoc.GetElementsByTagName("friends_count");
                string noOfFriends = xmlNodeFriends[0].InnerText.ToString();
                dictUserInfo.Add("NoOfFriends", noOfFriends);
                XmlNodeList xmlNodeListStatus = xmlDoc.GetElementsByTagName("statuses_count");
                string noOfStatuses = xmlNodeListStatus[0].InnerText.ToString();
                dictUserInfo.Add("NoOfStatus", noOfStatuses);
                XmlNodeList xmlNodeListImage = xmlDoc.GetElementsByTagName("profile_image_url");
                string imageUrl = xmlNodeListImage[0].InnerText.ToString();
                dictUserInfo.Add("ImageUrl", imageUrl);
            }
            catch
            {
                //System.Windows.Forms.MessageBox.Show(ex.Message );
            }
            return dictUserInfo;
        }
Exemplo n.º 19
0
 public bool UpdateStatus(TwitterUser twitterUser, string StatusText,string goodProxy)
 {
     TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
     XmlDocument xmlDoc = new XmlDocument();
     string actionUrl = Globals.getStatusUrl + "?status=" + StatusText;
     string Response = twitterWebRequest.PerformWebRequest(twitterUser ,actionUrl ,"POST",true,goodProxy );
     xmlDoc.Load(new StringReader(Response));
     Logger.LogText("Status has been updated");
     return true;
 }
Exemplo n.º 20
0
 public bool FollowUser(TwitterUser twitterUser, string UserToFollow,string goodProxy)
 {
     TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
     string actionUrl = Globals.getFollowUserUrl + UserToFollow;
     string response = twitterWebRequest.PerformWebRequest(twitterUser, actionUrl, "POST", true,goodProxy );
     if (response.Contains("The remote server returned an error: (403) Forbidden"))
     {
         return false;
     }
     XmlDocument xmlDoc = new XmlDocument();
     try
     {
         xmlDoc.Load(new StringReader(response));
         XmlNodeList xmlNodeID = xmlDoc.GetElementsByTagName("id");
         if (xmlNodeID != null)
             return true;
         else
             return false;
     }
     catch
     {
         return false;
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// This Method Will Get All Trends Of Twitter
 /// </summary>
 /// <param name="User">Twitter User Name And Password</param>
 /// <returns>Json Text Of Trends</returns>
 public string Trends(TwitterUser User)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string response = twtWebReq.PerformWebRequest(User, Globals.TrendsUrl, "Get", true, "");
     return response;
 }
Exemplo n.º 22
0
 public Search()
 {
     xmlResult = new XmlDocument();
     objTwitterWebRequest = new TwitterWebRequest();
 }
Exemplo n.º 23
0
 public bool FollowUserByScreenName(TwitterUser twitterUser, string UserToFollow, string proxy)
 {
     TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
     string actionUrl = "http://twitter.com/friendships/create.xml?screen_name=" + UserToFollow;
     string response = twitterWebRequest.PerformWebRequest(twitterUser, actionUrl, "POST", true, proxy);
     XmlDocument xmlDoc = new XmlDocument();
     try
     {
         xmlDoc.Load(new StringReader(response));
         XmlNodeList xmlNodeID = xmlDoc.GetElementsByTagName("id");
         if (xmlNodeID != null)
             return true;
         else
             return false;
     }
     catch
     {
         return false;
     }
 }
Exemplo n.º 24
0
        public bool UnfollowUser(TwitterUser twitterUser, string UserToUnfollow,string goodProxy)
        {
            TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
            string actionUrl = Globals.getUnfollowUserUrl + UserToUnfollow;
            string response = twitterWebRequest.PerformWebRequest(twitterUser, actionUrl, "POST", true,goodProxy );
            XmlDocument xmlDoc = new XmlDocument();
            try
            {
                xmlDoc.Load(new StringReader(response));
                XmlNodeList xmlNodeID = xmlDoc.GetElementsByTagName("id");
                if (xmlNodeID != null)
                    return true;
                else
                    return false;
            }
            catch
            {
                return false;
            }

        }
Exemplo n.º 25
0
        public List<string> SearchByKeyword(string SearchKey, int pageNumber,string lang, string proxy)
        {
            if (pageNumber < 1 && pageNumber > 15)
                pageNumber = 1;
            List<string> users = new List<string>();
            TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
            XmlDocument xmlDoc = new XmlDocument();
            Random rd = new Random();
            string actionUrl = Globals.getSearchUrl + SearchKey + "&rpp=100&page=" + pageNumber+"&lang="+lang;
            string response = twitterWebRequest.PerformWebRequest(new TwitterUser(), actionUrl, "GET", false, proxy);
            xmlDoc.Load(new StringReader(response));
            XmlNodeList xmlNodeList = xmlDoc.GetElementsByTagName("name");

            foreach (XmlNode node in xmlNodeList)
            {

                string[] user = node.InnerText.Split(' ');
                users.Add(user[0]);

            }
            return users;
        }
Exemplo n.º 26
0
 public bool HasADefaultPicture(string UserId)
 {
     string  actionUrl = "http://twitter.com/users/show.xml?id="+UserId;
     TwitterWebRequest twitterWebRequest = new TwitterWebRequest();
     string response = twitterWebRequest.PerformWebRequest(new TwitterUser(), actionUrl, "GET", true, "");
     XmlDocument xmlDoc = new XmlDocument();
     
     xmlDoc.Load(new StringReader(response));
     XmlNodeList xmlNodeID = xmlDoc.GetElementsByTagName("profile_image_url");
     foreach (XmlNode s in xmlNodeID)
     {
         if (s.InnerText.Contains("default_profile_normal"))
         {
             return true;
         }
     }
     return false;
 }