本文整理汇总了C#中GlobusHttpHelper类的典型用法代码示例。如果您正苦于以下问题:C# GlobusHttpHelper类的具体用法?C# GlobusHttpHelper怎么用?C# GlobusHttpHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlobusHttpHelper类属于命名空间,在下文中一共展示了GlobusHttpHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckVersion
private void CheckVersion()
{
try
{
thisVersionNumber = GetAssemblyVersion();
string textFileLocationOnServer = "http://licensing.facedominator.com/licensing/ID/IDCheckVer/IDLatestVersion.txt";
GlobusHttpHelper httpHelper = new GlobusHttpHelper();
string textFileData = httpHelper.getHtmlfromUrl(new Uri(textFileLocationOnServer));
string verstatus = string.Empty;
if (Globals.IsProVersion)
{
verstatus = "Fdpro Version";
}
if (Globals.IsBasicVersion)
{
verstatus = "Fdbasic Version";
}
else if (Globals.IsProVersion && Globals.IsBasicVersion)
{
verstatus = Globals.Licence_Details.Split('&')[1];
}
string latestVersion = Regex.Split(textFileData, "<:>")[0];
string updateVersionPath = Regex.Split(textFileData, "<:>")[1];
if (thisVersionNumber == latestVersion)
{
this.Dispatcher.Invoke(new Action(delegate
{
ModernDialog.ShowMessage("You have the Updated Version", "Information", btnMessage);
}));
}
else
{
this.Dispatcher.Invoke(new Action(delegate
{
var check = ModernDialog.ShowMessage("An Updated Version Available - Do you Want to Upgrade!", "Update Available", btnUsed);
if (check.ToString().Equals("Yes"))
{
System.Diagnostics.Process.Start("iexplore", updateVersionPath);
this.Dispatcher.Invoke(new Action(delegate
{
this.Close();
}));
}
}));
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
示例2: ActivateAccount
public bool ActivateAccount(string Email, string Password, ref GlobusHttpHelper globusHelper)
{
EmailActivator.ClsEmailActivator EmailActivate = new EmailActivator.ClsEmailActivator();
bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
if (verified)
{
return verified;
}
else
{
return verified;
}
}
示例3: BoardMethod
public void BoardMethod(string BoardName, string BoardUrl, ref PinInterestUser objPinInUser)
{
try
{
try
{
lstThreadsBoards.Add(Thread.CurrentThread);
lstThreadsBoards.Distinct().ToList();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{ };
lock (this)
{
string BoardId = string.Empty;
AddNewPinManager objaddnewPin = new AddNewPinManager();
RePinManager objRepin = new RePinManager();
try
{
boardinput.Add(Thread.CurrentThread);
boardinput.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{ };
if (string.IsNullOrEmpty(BoardName))
{
try
{
List<string> baordnames = GetAllBoardNames_new(ref objPinInUser);
BoardName = baordnames[RandomNumberGenerator.GenerateRandom(0, baordnames.Count - 1)];
BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser);
}
catch (Exception ex)
{ };
}
else
{
//testing
GlobusHttpHelper objHttp = new GlobusHttpHelper();
try
{
BoardId = objaddnewPin.GetBoardId_Board(BoardName, ref objPinInUser);
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
}
if (string.IsNullOrEmpty(BoardId))
{
BoardId = objaddnewPin.GetBoardId(BoardName, ref objPinInUser);
}
int counter = 0;
int RepinCounter = 0;
if (!BoardId.Contains("failure"))
{
if (!string.IsNullOrEmpty(BoardId))
{
if (PDGlobals.ValidateNumber(BoardId))
{
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Pins From Board :" + BoardUrl + " ]");
clsSettingDB db = new clsSettingDB();
List<string> lstPins = new List<string>();
lstPins = GetBoardPinsNew(BoardId, BoardUrl, 10, ref objPinInUser);
lstPins.Distinct();
List<string> lstOfRepin = new List<string>();
lstOfRepin.AddRange(lstPins);
string[] lstPinNo = null;
lstPinNo = lstPins.ToArray();
//getting lstPins length
int lenOFlstPins = lstOfRepin.Count;
foreach (string Pins in lstPinNo)
{
if (MaxRePinCount > RepinCounter)
{
string Message = string.Empty;
if (ClGlobul.lstBoardRepinMessage.Count > 0)
{
if (counter < ClGlobul.lstBoardRepinMessage.Count)
{
Message = ClGlobul.lstBoardRepinMessage[counter];
}
else
{
counter = 0;
Message = ClGlobul.lstBoardRepinMessage[counter];
}
}
//.........这里部分代码省略.........
示例4: StartMultiThreadsUsingUsername
public void StartMultiThreadsUsingUsername(object parameters)
{
try
{
if (!isStopUsingUsername)
{
try
{
lstThreadsUsingUsername.Add(Thread.CurrentThread);
lstThreadsUsingUsername.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
try
{
Array paramsArray = new object[1];
paramsArray = (Array)parameters;
InstagramUser objFacebookUser = (InstagramUser)paramsArray.GetValue(0);
if (!objFacebookUser.isloggedin)
{
GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
objFacebookUser.globusHttpHelper = objGlobusHttpHelper;
//Login Process
Accounts.AccountManager objAccountManager = new AccountManager();
status = objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser);
}
if (objFacebookUser.isloggedin)
{
StartActionFollowerModule(ref objFacebookUser);
}
else
{
GlobusLogHelper.log.Info("Couldn't Login With Username : " + objFacebookUser.username);
GlobusLogHelper.log.Debug("Couldn't Login With Username : " + objFacebookUser.username);
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
finally
{
try
{
{
lock (lockrThreadControlleUsingUsername)
{
countThreadControllerUsingUsername--;
Monitor.Pulse(lockrThreadControlleUsingUsername);
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
}
示例5: EmailVerificationMultithreaded
/// <summary>
/// Makes Http Request to Confirmation URL from Mail, also requests other JS, CSS URLs
/// </summary>
/// <param name="ConfirmationUrl"></param>
/// <param name="gif"></param>
/// <param name="logpic"></param>
public void EmailVerificationMultithreaded(string ConfirmationUrl, string gif, string logpic, string email, string password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref GlobusHttpHelper HttpHelper)
{
int intProxyPort = 80;
Regex IdCheck = new Regex("^[0-9]*$");
if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
{
intProxyPort = int.Parse(proxyPort);
}
string pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfirmationUrl), proxyAddress, intProxyPort, proxyUsername, proxyPassword);
string valueLSD = "name=" + "\"lsd\"";
string pgSrc_Login = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));
int startIndex = pgSrc_Login.IndexOf(valueLSD) + 18;
string value = pgSrc_Login.Substring(startIndex, 5);
//Log("Logging in with " + Username);
string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + email.Split('@')[0] + "%40" + email.Split('@')[1] + "&pass=" + password + "&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUsername, proxyPassword);
pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrl(new Uri(ConfirmationUrl));
try
{
string pgSrc_Gif = HttpHelper.getHtmlfromUrl(new Uri(gif));
}
catch { }
try
{
string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
}
catch { }
try
{
string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic));
}
catch { }
//** User Id ***************//////////////////////////////////
string UsreId = string.Empty;
if (string.IsNullOrEmpty(UsreId))
{
UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user");
}
//*** Post Data **************//////////////////////////////////
string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
if (string.IsNullOrEmpty(fb_dtsg))
{
fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg");
}
string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);
if (string.IsNullOrEmpty(post_form_id))
{
post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id");
}
string pgSrc_email_confirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));
string pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));
#region Skipping Code
///Code for skipping additional optional Page
try
{
string phstamp = "165816812085115" + RandomNumberGenerator.GenerateRandom(10848130, 10999999);
string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=" + UsreId + "&phstamp=" + phstamp;
string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep);
Thread.Sleep(1000);
}
catch { }
pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer"));
//** FB Account Check email varified or not ***********************************************************************************//
#region FB Account Check email varified or not
//string pageSrc1 = string.Empty;
string pageSrc2 = string.Empty;
string pageSrc3 = string.Empty;
string pageSrc4 = string.Empty;
string substr1 = string.Empty;
//if (pgSrc_contact_importer.Contains("Are your friends already on Facebook?") && pgSrc_contact_importer.Contains("Skip this step"))
if (true)
{
//.........这里部分代码省略.........
示例6: FinishRegistrationMultiThreaded
private void FinishRegistrationMultiThreaded(string responseRegistration, string email, string password, string proxyAddress, string proxyPort, string proxyUser, string proxyPassword, ref GlobusHttpHelper HttpHelper)
{
if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("registration_succeeded"))
{
AddToListBox("Registration Succeeded");
try
{
string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email));
/// JS, CSS, Image Requests
RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
}
catch { };
VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper);
}
//else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("It looks like you already have an account on Facebook"))
else
{
AddToListBox("It looks like you already have an account on Facebook");
try
{
string res = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/c.php?email=" + email));
/// JS, CSS, Image Requests
RequestsJSCSSIMG.RequestJSCSSIMG(res, ref HttpHelper);
}
catch { };
VerifiyAccountMultiThreaded(email, password, proxyAddress, proxyPort, proxyUser, proxyPassword, ref HttpHelper);
}
#region Old Code
//else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("The text you entered didn't match the security check"))
//{
// //AddToListBox("The text you entered didn't match the security check. Retrying..");
// //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
// ////And we don't want to switch the account now
// //GoToNextAccount();
//}
//else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("You took too much time"))
//{
// //AddToListBox("You took too much time in submitting captcha. Retrying..");
// //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
// ////And we don't want to switch the account now
// //GoToNextAccount();
//}
//else if (!string.IsNullOrEmpty(responseRegistration) && responseRegistration.Contains("to an existing account"))
//{
// //AddToListBox("This email is associated to an existing account");
// //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
// ////And we don't want to switch the account now
// //GoToNextAccount();
//}
//else
//{
// if (retryCounter <= 2)
// {
// ////AddToListBox("Error in submitting captcha. Retrying..");
// //accountCounter--; //Decrement Counter as it'll be incremented in next line => GoToNextAccount()
// //And we don't want to switch the account now
// ////GoToNextAccount();
// }
// else
// {
// //retryCounter = 0; //Reset the retryCounter as we're switching account now
// //AddToListBox("Couldn't create account with " + Email + "---Switching to next account");
// //GoToNextAccount();
// }
//}
#endregion
}
示例7: ThreadPoolMethod
private void ThreadPoolMethod(object parameters)
{
try
{
//string email = (string)parameters;
Array paramsArray = new object[2];
paramsArray = (Array)parameters;
string email = (string)paramsArray.GetValue(0);
int count_Names = (int)paramsArray.GetValue(1);
GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
string post_form_id = string.Empty;
string lsd = string.Empty;
string reg_instance = string.Empty;
string firstname = string.Empty;
string lastname = string.Empty;
string reg_email__ = string.Empty;
string reg_email_confirmation__ = string.Empty;
string reg_passwd__ = string.Empty;
string sex = string.Empty;
string birthday_month = string.Empty;
string birthday_day = string.Empty;
string birthday_year = string.Empty;
string captcha_persist_data = string.Empty;
string captcha_session = string.Empty;
string extra_challenge_params = string.Empty;
string recaptcha_public_key = string.Empty;
string authp_pisg_nonce_tt = null;
string authp = string.Empty;
string psig = string.Empty;
string nonce = string.Empty;
string tt = string.Empty;
string time = string.Empty;
string challenge = string.Empty;
string CaptchaSummit = string.Empty;
string Email = string.Empty;
string Password = string.Empty;
string proxyAddress = string.Empty;
string proxyPort = string.Empty;
string proxyUsername = string.Empty;
string proxyPassword = string.Empty;
try
{
Email = email.Split(':')[0];
Password = email.Split(':')[1];
firstname = listFirstName[count_Names];
lastname = listLastName[count_Names];
}
catch (Exception ex){ AddToListBox(ex.Message); }
AddToListBox("Creating Account with " + Email);
string responseMessage = string.Empty;
string captchaSrcMulti = string.Empty;
#region Commented
// captchaSrcMulti = GetCaptchaImageMulti(email, ref HttpHelper, ref post_form_id, ref lsd,
//ref reg_instance,
//ref firstname,
//ref lastname,
//ref reg_email__,
//ref reg_email_confirmation__,
//ref reg_passwd__,
//ref sex,
//ref birthday_month,
//ref birthday_day,
//ref birthday_year,
//ref captcha_persist_data,
//ref captcha_session,
//ref extra_challenge_params,
//ref recaptcha_public_key,
//ref authp_pisg_nonce_tt,
//ref authp,
//ref psig,
//ref nonce,
//ref tt,
//ref time,
//ref challenge,
//ref CaptchaSummit);
// if (email.Split(':').Length > 5)
// {
// proxyAddress = email.Split(':')[2];
// proxyPort = email.Split(':')[3];
// proxyUsername = email.Split(':')[4];
// proxyPassword = email.Split(':')[5];
// //AddToListBox("Setting proxy " + proxyAddress + ":" + proxyPort);
// }
// else if (email.Split(':').Length == 4)
// {
// //MessageBox.Show("Private proxies not loaded with emails \n Accounts will be created with public proxies");
// proxyAddress = email.Split(':')[2];
//.........这里部分代码省略.........
示例8: GetUserFollowing_newComment
public List<string> GetUserFollowing_newComment(string UserName, int NoOfPage, int FollowingCount)
{
List<string> TotalFollowerComment = new List<string>();
try
{
List<string> FollowerComment = new List<string>();
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Starting Extraction Of Following For " + UserName + " ]");
GlobusHttpHelper objglobusHttpHelper = new GlobusHttpHelper();
for (int i = 1; i <= 1000; i++)
{
try
{
string FollowerPageSource = string.Empty;
if (i == 1)
{
FollowUrl = "http://pinterest.com/" + UserName + "/following/";
FollowerPageSource = objglobusHttpHelper.getHtmlfromUrl(new Uri(FollowUrl), referer, string.Empty, "");
referer = FollowUrl;
}
else
{
FollowUrl = "https://www.pinterest.com/resource/UserFollowingResource/get/?source_url=%2F" + UserName + "%2Ffollowing%2F&data=%7B%22options%22%3A%7B%22username%22%3A%22" + UserName + "%22%2C%22bookmarks%22%3A%5B%22" + bookmark + "%3D%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App(module%3D%5Bobject+Object%5D)&_=144204352215" + (i - 1);
try
{
FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), referer, "", 80, string.Empty, "", "");
}
catch
{
FollowerPageSource = objglobusHttpHelper.getHtmlfromUrlProxy(new Uri(FollowUrl), "", Convert.ToInt32(""), "", "");
}
if (FollowerPageSource.Contains("Whoops! We couldn't find that page."))
{
break;
}
}
///Get App Version
if (FollowerPageSource.Contains("app_version") && string.IsNullOrEmpty(AppVersion))
{
string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "app_version");
if (ArrAppVersion.Count() > 0)
{
string DataString = ArrAppVersion[ArrAppVersion.Count() - 1];
int startindex = DataString.IndexOf("\": \"");
int endindex = DataString.IndexOf("\", \"");
AppVersion = DataString.Substring(startindex, endindex - startindex).Replace("\": \"", "");
}
}
///get bookmarks value from page
///
if (FollowerPageSource.Contains("bookmarks"))
{
string[] bookmarksDataArr = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "bookmarks");
string Datavalue = string.Empty;
if (bookmarksDataArr.Count() > 2)
Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 2];
else
Datavalue = bookmarksDataArr[bookmarksDataArr.Count() - 1];
bookmark = Datavalue.Substring(Datavalue.IndexOf(": [\"") + 4, Datavalue.IndexOf("]") - Datavalue.IndexOf(": [\"") - 5);
}
try
{
if (!FollowerPageSource.Contains("No one has followed"))
{
List<string> lst = objGlobusRegex.GetHrefUrlTags(FollowerPageSource);
if (lst.Count == 0)
{
lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "href").ToList();
if (lst.Count() == 1)
{
lst = System.Text.RegularExpressions.Regex.Split(FollowerPageSource, "\"username\":").ToList();
}
}
foreach (string item in lst)
{
if (item.Contains("class=\"userWrapper") || item.Contains("class=\\\"userWrapper"))
{
try
{
if (item.Contains("\\"))
{
int FirstPinPoint = item.IndexOf("=\\\"/");
int SecondPinPoint = item.IndexOf("/\\\"");
User = item.Substring(FirstPinPoint, SecondPinPoint - FirstPinPoint).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty).Trim();
}
else
{
int FirstPinPoint = item.IndexOf("href=");
int SecondPinPoint = item.IndexOf("class=");
//.........这里部分代码省略.........
示例9: GetFollowings_NewForMobileVersion
public List<string> GetFollowings_NewForMobileVersion(string userID, out string ReturnStatus)
{
GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
//Log("[ " + DateTime.Now + " ] => [ Searching For Followers For " + userID + " ]");
string cursor = "0";
int counter = 0;
string FollowingUrl = string.Empty;
List<string> lstIds = new List<string>();
string Data = string.Empty;
string FindCursor = string.Empty;
try
{
StartAgain:
//Thread.Sleep(1000);
string[] splitRes = new string[] { };
if (counter == 0)
{
string aa = "https://mobile.twitter.com/" + userID + "/following";
Data = HttpHelper.getHtmlfromUrl(new Uri(aa), "", "");
if (Data.Contains("class=\"w-button-more\""))
{
int startindex = Data.IndexOf("cursor=");
string start = Data.Substring(startindex).Replace("cursor=", "");
int lastindex = start.IndexOf(">");
if (lastindex < 0)
{
lastindex = start.IndexOf(">");
}
string end = start.Substring(0, lastindex).Replace("\"", "");
cursor = end;
}
else
{
//splitRes = Regex.Split(Data, "<div class=\"GridTimeline-items");
}
counter++;
//Data = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + userID + "/followers"), "", "");
}
else
{
Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
if (string.IsNullOrEmpty(Data))
{
for (int i = 1; i <= 3; i++)
{
Thread.Sleep(3000);
Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
if (!string.IsNullOrEmpty(Data))
{
break;
}
}
//if (string.IsNullOrEmpty(Data))
//{
// Log(" pagesource not found ");
//}
}
if (Data == "Too Many Requestes")
{
//Log("[ " + DateTime.Now + " ] => [ Wait for 15 minutes For furthur Scraping because Twitter banned for scraping. its already too many requestes. ]");
Thread.Sleep(15 * 60 * 1000);
Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
if (string.IsNullOrEmpty(Data) || Data == "Too Many Requestes")
{
//Log("[ " + DateTime.Now + " ] => [ Wait for 5 minutes more For furthur Scraping. ]");
Thread.Sleep(5 * 60 * 1000);
for (int i = 1; i <= 3; i++)
{
Thread.Sleep(3000);
Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
if (!string.IsNullOrEmpty(Data))
{
break;
}
}
//if (string.IsNullOrEmpty(Data))
//{
// Log(" pagesource not found ");
//}
}
}
//var avc = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(Data);
//cursor = string.Empty;
//string DataHtml = (string)avc["items_html"];
//cursor = (string)avc["cursor"];
}
if (cursor == "0")
{
Thread.Sleep(2000);
Data = HttpHelper.getHtmlfromUrl(new Uri("https://mobile.twitter.com/" + userID + "/following?cursor=" + cursor), "", "");
}
if (Data.Contains("401 Unauthorized"))
//.........这里部分代码省略.........
示例10: GetUserIDFromUsername_New
public static string GetUserIDFromUsername_New(string username, out string Status, ref GlobusHttpHelper HttpHelper)
{
string GetStatus = string.Empty;
clsDBQueryManager DB = new clsDBQueryManager();
DataSet ds = DB.GetUserId(username);
string user_id = string.Empty;
try
{
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dataRow in ds.Tables["tb_UsernameDetails"].Rows)
{
user_id = dataRow.ItemArray[0].ToString();
Status = "No Error";
return user_id;
}
}
}
catch { };
try
{
string id = string.Empty;
string pagesource = string.Empty;
pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + username), "", "");
if (!pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.") && !pagesource.Contains("Sorry, that page does not exist") && !pagesource.Contains("User has been suspended"))
{
// pagesource = HttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/" + username), "", "");
try
{
int startindex = pagesource.IndexOf("profile_id");
string start = pagesource.Substring(startindex).Replace("profile_id", "");
int endindex = start.IndexOf(",");
string end = start.Substring(0, endindex).Replace(""", "").Replace("\"", "").Replace(":", "").Trim();
user_id = end.Trim();
}
catch
{
}
if (string.IsNullOrEmpty(user_id))
{
try
{
int startindex = pagesource.IndexOf("ProfileTweet-authorDetails\">");
string start = pagesource.Substring(startindex).Replace("ProfileTweet-authorDetails\">", "");
int endindex = start.IndexOf("\">");
string end = start.Substring(start.IndexOf("data-user-id="), endindex - start.IndexOf("data-user-id=")).Replace("data-user-id=", "").Replace("\"", "");
user_id = end.Trim();
}
catch
{
}
}
if (string.IsNullOrEmpty(user_id))
{
try
{
int startindex = pagesource.IndexOf("stats js-mini-profile-stats \" data-user-id=\"");
if (startindex == -1)
{
startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting \" data-user-id=\"");
}
if (startindex == -1)
{
startindex = pagesource.IndexOf("user-actions btn-group not-following not-muting protected\" data-user-id=\"");
}
string start = pagesource.Substring(startindex).Replace("stats js-mini-profile-stats \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting \" data-user-id=\"", "").Replace("user-actions btn-group not-following not-muting protected\" data-user-id=\"", "").Trim();
//int endindex = start.IndexOf("\">");
int endindex = start.IndexOf("\"");
string end = start.Substring(0, endindex);
user_id = end.Replace("\"", "");
}
catch
{
}
}
}
else if (pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
{
GetStatus = "Rate limit exceeded";
}
else if (pagesource.Contains("Sorry, that page does not exist"))
{
GetStatus = "Sorry, that page does not exist";
}
else if (pagesource.Contains("User has been suspended"))
{
GetStatus = "User has been suspended";
}
}
catch (Exception ex)
{
Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
//.........这里部分代码省略.........
示例11: CommentOperation
public void CommentOperation(string Acc, string[] Hash)
{
try
{
lstThreadsCommentPoster.Add(Thread.CurrentThread);
lstThreadsCommentPoster.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
try
{
string status = string.Empty;
string[] arrAcc = Regex.Split(Acc, ":");
InstagramUser objInstagramUser = new InstagramUser(arrAcc[0], arrAcc[1], arrAcc[2], arrAcc[3]);
GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
objInstagramUser.globusHttpHelper = objGlobusHttpHelper;
AccountManager objAccountManager = new AccountManager();
if (!objInstagramUser.isloggedin)
{
status = objAccountManager.LoginUsingGlobusHttp(ref objInstagramUser);
}
if (status == "Success" || (objInstagramUser.isloggedin))
{
foreach (string itemHash in Hash)
{
if (!string.IsNullOrEmpty(itemHash))
{
//Operation
string[] Data_ID = Regex.Split(itemHash, ",");
string daaa = objInstagramUser.username;
foreach (string Photo_ID in Data_ID)
{
if (!string.IsNullOrEmpty(Photo_ID))
{
// CommentOnSnapsVideos(ref objInstagramUser, Photo_ID);
getComment(Photo_ID, ref objInstagramUser);
}
else
{
break;
}
if (minDelayCommentPoster != 0)
{
mindelay = minDelayCommentPoster;
}
if (maxDelayCommentPoster != 0)
{
maxdelay = maxDelayCommentPoster;
}
Random obj_rn = new Random();
int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
delay = obj_rn.Next(mindelay, maxdelay);
GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds ]");
Thread.Sleep(delay * 1000);
}
}
GlobusLogHelper.log.Info("=========================");
GlobusLogHelper.log.Info("Process Completed !!!");
GlobusLogHelper.log.Info("=========================");
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Info("Error : " + ex.StackTrace);
}
}
示例12: SendFriendRequestMultiThreads
private void SendFriendRequestMultiThreads(object parameters)
{
try
{
// if (!isStopWallPoster)
{
try
{
lstThreadsWallPoster.Add(Thread.CurrentThread);
lstThreadsWallPoster.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.StackTrace);
}
try
{
Array paramsArray = new object[1];
paramsArray = (Array)parameters;
FacebookUser objFacebookUser = (FacebookUser)paramsArray.GetValue(0);
if (!objFacebookUser.isloggedin)
{
GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
objFacebookUser.globusHttpHelper = objGlobusHttpHelper;
//Login Process
Accounts.AccountManager objAccountManager = new AccountManager();
objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser);
}
if (objFacebookUser.isloggedin)
{
AddToLogger_FriendsManager("Successful login With : "+objFacebookUser.username);
if (StartFriendsProcessUsing=="Add Friends via fanpage url")
{
FriendRequestViaFanPageUrl(objFacebookUser);
AddToLogger_FriendsManager("Process Completed With : "+objFacebookUser.username);
}
else if (StartFriendsProcessUsing==" Add friends from keyword")
{
StartActionFriendsManager(ref objFacebookUser);
AddToLogger_FriendsManager("Process Completed With : "+objFacebookUser.username);
}
else if(StartFriendsProcessUsing=="Send Text message on Friends wall")
{
AddToLogger_FriendsManager("Please wait Send Text message process started ....");
WallPostingWithTestMessage(ref objFacebookUser);
AddToLogger_FriendsManager("Send text message on friends wall Process completed .");
}
else if(StartFriendsProcessUsing=="Send Url message on Friends wall")
{
WallPostingNew(ref objFacebookUser);
}
else if(StartFriendsProcessUsing=="Send Picture on Friends wall")
{
StartActionPostPicOnWall(ref objFacebookUser);
}
// Call SendFriendRequests
//SendFriendRequests(ref objFacebookUser);
}
else
{
AddToLogger_FriendsManager("Couldn't Login With Username : " + objFacebookUser.username);
}
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.StackTrace);
}
//GlobusLogHelper.log.Debug("Process completed !!");
//AddToLogger_FriendsManager("Process completed !!");
}
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.StackTrace);
}
finally
{
try
{
if (!isRequestFriendsStop)
{
lock (requestFriendsThreadControllerlockr)
{
requestFriendsThreadControllerCount--;
Monitor.Pulse(requestFriendsThreadControllerlockr);
//.........这里部分代码省略.........
示例13: StartLikePageMultiThreads
public void StartLikePageMultiThreads(object parameters)
{
try
{
if (!isStopFanPageLiker)
{
try
{
lstThreadsFanPageLiker.Add(Thread.CurrentThread);
lstThreadsFanPageLiker.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
try
{
Array paramsArray = new object[1];
paramsArray = (Array)parameters;
FacebookUser objFacebookUser = (FacebookUser)paramsArray.GetValue(0);
if (!objFacebookUser.isloggedin)
{
GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper();
objFacebookUser.globusHttpHelper = objGlobusHttpHelper;
//Login Process
Accounts.AccountManager objAccountManager = new AccountManager();
objAccountManager.LoginUsingGlobusHttp(ref objFacebookUser);
}
if (objFacebookUser.isloggedin)
{
// Call LikePage
StartFanPageLikerProcess(ref objFacebookUser);
}
else
{
GlobusLogHelper.log.Info("Couldn't Login With Username : " + objFacebookUser.username);
GlobusLogHelper.log.Debug("Couldn't Login With Username : " + objFacebookUser.username);
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
finally
{
try
{
// if (!isStopFanPageLiker)
{
lock (lockrThreadControllerFanPageLiker)
{
countThreadControllerFanPageLiker--;
Monitor.Pulse(lockrThreadControllerFanPageLiker);
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
}
示例14: ParseJson_Comments_Next_Phase1
/// <summary>
/// Gets Next Page URLs as well as End User IDs from Comment
/// </summary>
/// <param name="jsonRes"></param>
/// <param name="PageURL"></param>
private void ParseJson_Comments_Next_Phase1(string jsonRes, string PageURL)
{
try
{
lstFanPageScraperThreads.Add(Thread.CurrentThread);
lstFanPageScraperThreads.Distinct();
Thread.CurrentThread.IsBackground = true;
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
try
{
string jsonData = jsonRes;
JObject likes = null;
JObject Data = null;
try
{
Data = JObject.Parse(jsonData);
likes = (JObject)Data["likes"];
}
catch { };
//Paging
JObject paging = null;//(JObject)likes["paging"];
if (likes != null) //Get Next Page Node under Likes Node
{
paging = (JObject)likes["paging"];
}
else //If no Likes Node, Get Next Page Node under Data Node
{
paging = (JObject)Data["paging"];
}
//Next URL
string next = (string)((JValue)paging["next"]);
int startIndx = next.IndexOf("limit=") + "limit=".Length;
int endIndx = next.IndexOf("&", startIndx);
string limitValueToReplace = "limit=" + next.Substring(startIndx, endIndx - startIndx);
next = next.Replace(limitValueToReplace, "limit=1000");
GlobusHttpHelper httpHelper = new GlobusHttpHelper();
string nextRes = httpHelper.getHtmlfromUrlProxy(new Uri(next), "", 80, "", "");
#region Get Next Page Data and IDs and Insert in tb_FbFirstID with Status=0 & Level=1, means End User ID
JObject nextData = JObject.Parse(nextRes);
JArray array_data = (JArray)nextData["data"];
foreach (var item in array_data)
{
try
{
JObject objData_Node = JObject.Parse(item.ToString());
JValue jVaule_id = (JValue)objData_Node["id"];
string str_id = jVaule_id.ToString().Replace("\"", "");
try
{
string queryResponse = string.Empty;
//qm.AddFirstID(str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, ref queryResponse);
DataSet ds = new DataSet();
RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : InsertChasngeLevel", str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, queryResponse });
if (queryResponse.Contains("locked"))
{
Thread.Sleep(1000);
// QueryManager myQueryManager = new QueryManager();
//myQueryManager.AddFirstID(str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, ref queryResponse);
RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : InsertChasngeLevel", str_id, "0", "1", System.DateTime.Now.ToString(), PageURL, queryResponse });
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
//.........这里部分代码省略.........
示例15: StartMission_Comments
/// <summary>
/// Processes Comment IDs
/// Gets Next Page URL as well as End User IDs
/// </summary>
/// <param name="objCommentID">Comment ID</param>
private void StartMission_Comments(object objCommentID)
{
string CommentID = string.Empty;
try
{
if (!isStopFanPageScraper)
{
//string CommentID = (string)objCommentID;
string[] arrayParameters = (string[])objCommentID;
CommentID = (string)arrayParameters.GetValue(0);
string PageURL = (string)arrayParameters.GetValue(1);//(string)objCommentID;
GlobusHttpHelper httpHelper = new GlobusHttpHelper();
string GraphUrl = FBGlobals.Instance.fbgraphUrl + CommentID;
string jsonRes = string.Empty;
try
{
jsonRes = httpHelper.getHtmlfromUrlProxy(new Uri(FBGlobals.Instance.fbgraphUrl + CommentID + ""), "", 80, "", "");
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
ParseJson_Comments_Phase1(jsonRes, PageURL);
ParseJson_Comments_Next_Phase1(jsonRes, PageURL);
///After processing Comment ID, Update its Status as 1 => Processed
try
{
//qm.UpdateStatusForLevelOne(CommentID);
DataSet ds = new DataSet();
RaiseEvent(ds, new string[] { "Model : FanPagePostRepository", "Function : UpdateStatusUsingFriendId", CommentID });
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
finally
{
//if (!IsCloseCalled)
{
countThreadController--;
lock (lockrThreadController)
{
//if (!IsCloseCalled)
{
Monitor.Pulse(lockrThreadController);
}
}
}
}
}