本文整理汇总了C#中BaseLib.GlobusHttpHelper.getHtmlfromUrl方法的典型用法代码示例。如果您正苦于以下问题:C# GlobusHttpHelper.getHtmlfromUrl方法的具体用法?C# GlobusHttpHelper.getHtmlfromUrl怎么用?C# GlobusHttpHelper.getHtmlfromUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseLib.GlobusHttpHelper
的用法示例。
在下文中一共展示了GlobusHttpHelper.getHtmlfromUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodeGetCharector
public static string DecodeGetCharector(string PageString)
{
GlobusHttpHelper obj_http = new GlobusHttpHelper();
string GetOrginalString = string.Empty;
try
{
string[] Arr = System.Text.RegularExpressions.Regex.Split(PageString, "&#");
foreach (var item_Arr in Arr)
{
try
{
string ss = string.Empty;
ss = "&#" + Uri.EscapeDataString(Utils.getBetween("&#" + item_Arr, "&#", ";")) + ";";
string Url = "http://chars.suikawiki.org/string?s=" +Uri.EscapeDataString(ss);
string PageSource = obj_http.getHtmlfromUrl(new Uri(Url));
string[] Arr11 = System.Text.RegularExpressions.Regex.Split(PageSource, "escapes");
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
return GetOrginalString;
}
示例2: getAllMembers
public Dictionary<string, string> getAllMembers(ref GlobusHttpHelper HttpHelper, string userName)
{
Dictionary<string, string> details = new Dictionary<string, string>();
try
{
string url = "https://www.linkedin.com/people/invites?trk=connect_hub_manage_invitations_sent";
string src = HttpHelper.getHtmlfromUrl(new Uri(url));
if (src.Contains("{\"lastName\""))
{
string[] arr = Regex.Split(src, "{\"lastName\"");
foreach (string item in arr)
{
try
{
if (!item.Contains("<!DOCTYPE"))
{
string invitationId=string.Empty;
string Id=string.Empty;
string fullName = Utils.getBetween(item, "i18n_check_to_remove\":\"","\",");
fullName = Utils.getBetween(fullName + "###", "to remove", "###");
fullName= fullName.Trim();
if (item.Contains(""))
{
invitationId = Utils.getBetween(item, "\"invitationId\":\"", "\",\"");
}
if (item.Contains("memberId\":"))
{
Id = Utils.getBetween(item, "memberId\":", "}");
}
Id = userName + ":" + Id;
details.Add(Id, fullName + ":" + invitationId);
}
}
catch
{ }
}
}
}
catch
{ }
return details;
}
示例3: LogoutHttpHelper
public bool LogoutHttpHelper(ref GlobusHttpHelper HttpHelper)
{
try
{
//string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/"));
if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
{
string h = string.Empty;
string post_form_id = string.Empty;
string fb_dtsg = string.Empty;
if (pageSource1.Contains("\"h\""))
{
string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
string[] ArrTemp = strTemp.Split('"');
h = ArrTemp[3];
}
if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
{
string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
string[] ArrTemp = strTemp.Split('"');
post_form_id = ArrTemp[2];
fb_dtsg = ArrTemp[6];
}
string ResponseLogout = HttpHelper.postFormData(new Uri("http://www.facebook.com/logout.php"), "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&ref=mb&h=" + h);
return true;
}
return false;
}
catch (Exception ex)
{
return false;
Console.WriteLine(ex.Message);
}
}
示例4: GetMultipleRecords
public void GetMultipleRecords(ref GlobusHttpHelper HttpHelper)
{
try
{
string csrfToken = string.Empty;
string LastName = string.Empty;
string FirstName = string.Empty;
string Industry = string.Empty;
string Postalcode = string.Empty;
string Distance = string.Empty;
string contentSummary = string.Empty;
string Title = string.Empty;
string Company = string.Empty;
string school = string.Empty;
string Country = string.Empty;
string countrycode = string.Empty;
string industrycode = string.Empty;
string rsid = string.Empty;
string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
try
{
try
{
string[] Arr_Pst = Regex.Split(postalCode, "(");
}
catch { }
try
{
Postalcode = postalCode.Substring(0, postalCode.IndexOf(" "));
Country = postalCode.Replace(Postalcode, string.Empty).Replace(")", string.Empty).Replace("(", string.Empty).Trim();
}
catch
{
if (Postalcode == string.Empty)
{
Postalcode = postalCode;
}
}
}
catch { }
if (pageSource.Contains("csrfToken"))
{
csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 100);
string[] Arr = csrfToken.Split('&');
csrfToken = Arr[0];
csrfToken = csrfToken.Replace("csrfToken=", "");
csrfToken = csrfToken.Replace("%3A", ":");
}
InBoardPro.GetIndustryCode objIndustry = new GetIndustryCode();
Dictionary<string, string> Dict_IndustryCode = new Dictionary<string, string>();
Dict_IndustryCode = objIndustry.getIndustry();
foreach (KeyValuePair<string, string> item in Dict_IndustryCode)
{
try
{
string toloweritem = item.Value.ToLower();
string tolowerindustrytype = industryType.ToLower();
if (toloweritem == tolowerindustrytype)
{
//SearchCriteria.Country = item.Key;
industrycode = item.Key;
break;
}
}
catch
{
}
}
Dictionary<string, string> Dict_CountryCode = new Dictionary<string, string>();
Dict_CountryCode = objIndustry.getCountry();
foreach (KeyValuePair<string, string> item in Dict_CountryCode)
{
try
{
string toloweritem = item.Value.ToLower();
string tolowercountrytype = Country.ToLower();
if (toloweritem == tolowercountrytype)
{
countrycode = item.Key;
break;
}
}
catch
{
}
}
string Firstresponse = string.Empty;
if (string.IsNullOrEmpty(countrycode))
{
countrycode = "us";
}
string FirstGetRequestUrl = string.Empty;
string FirstGetResponse = string.Empty;
{
//.........这里部分代码省略.........
示例5: AddaCover
public bool AddaCover(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref string status)
{
bool isAddaCover = false;
string fb_dtsg = string.Empty;
string photo_id = string.Empty;
string UsreId = string.Empty;
try
{
string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));
UsreId = GlobusHttpHelper.GetParamValue(pageSource_Home, "user");
if (string.IsNullOrEmpty(UsreId))
{
UsreId = GlobusHttpHelper.ParseJson(pageSource_Home, "user");
}
fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
if (string.IsNullOrEmpty(fb_dtsg))
{
fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg");
}
NameValueCollection nvc = new NameValueCollection();
nvc.Add("fb_dtsg", fb_dtsg);
//nvc.Add("filename=", fb_dtsg);
nvc.Add("Content-Type:", "image/jpeg");
string response = HttpUploadFile_AddaCover(ref HttpHelper, UsreId, "https://upload.facebook.com/ajax/timeline/cover/upload/", "pic", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
try
{
string okay = HttpHelper.getHtmlfromUrl(new Uri("http://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"));
}
catch
{
}
if (!string.IsNullOrEmpty(response) && response.Contains("photo.php?fbid="))
{
#region PostData_ForCoverPhotoSelect
//fb_dtsg=AQCLSjCH&photo_id=130869487061841&profile_id=100004163701035&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=100004163701035&__a=1&phstamp=165816776831066772182
#endregion
try
{
string photo_idValue = response.Substring(response.IndexOf("photo.php?fbid="), response.IndexOf(";", response.IndexOf("photo.php?fbid=")) - response.IndexOf("photo.php?fbid=")).Replace("photo.php?fbid=", string.Empty).Trim();
string[] arrphoto_idValue = Regex.Split(photo_idValue, "[^0-9]");
foreach (string item in arrphoto_idValue)
{
try
{
if (item.Length > 6)
{
photo_id = item;
break;
}
}
catch
{
}
}
string postData = "fb_dtsg=" + fb_dtsg + "&photo_id=" + photo_id + "&profile_id=" + UsreId + "&photo_offset=0&video_id=&save=Save%20Changes&nctr[_mod]=pagelet_main_column_personal&__user=" + UsreId + "&__a=1&phstamp=165816776831066772182 ";
string postResponse = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/timeline/cover_photo_select.php"), postData);
if (!postResponse.Contains("error"))
{
//string ok = "ok";
isAddaCover = true;
}
if (string.IsNullOrEmpty(postResponse) || string.IsNullOrWhiteSpace(postResponse))
{
status = "Response Is Null !";
}
if (postResponse.Contains("errorSummary"))
{
string summary = GlobusHttpHelper.ParseJson(postResponse, "errorSummary");
string errorDescription = GlobusHttpHelper.ParseJson(postResponse, "errorDescription");
status = "Posting Error: " + summary + " | Error Description: " + errorDescription;
//FanPagePosterLogger("Posting Error: " + summary + " | Error Description: " + errorDescription);
}
}
catch
{
}
}
else
{
if (response.Contains("Please choose an image that"))
{
status = "Please choose an image that's at least 399 pixels wide";
}
}
}
catch
//.........这里部分代码省略.........
示例6: AddaPicture
public bool AddaPicture(ref GlobusHttpHelper HttpHelper, string Username, string Password, string localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId)
{
string pageSource = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
bool isSentPicMessage = false;
//string fb_dtsg = string.Empty;
string photo_id = string.Empty;
//string UsreId = string.Empty;
//xhpc_composerid = string.Empty;
//xhpc_targetid = string.Empty;
//message_text = string.Empty;
try
{
#region commentedCode
//string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));
//UsreId = GlobusHttpHelper.GetParamValue(pageSource_Home, "user");
//if (string.IsNullOrEmpty(UsreId))
//{
// UsreId = GlobusHttpHelper.ParseJson(pageSource_Home, "user");
//}
//fb_dtsg = GlobusHttpHelper.GetParamValue(pageSource_Home, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
//if (string.IsNullOrEmpty(fb_dtsg))
//{
// fb_dtsg = GlobusHttpHelper.ParseJson(pageSource_Home, "fb_dtsg");
//}
//string pageSource_HomeData = HttpHelper.getHtmlfromUrl(new Uri(targeturl));
//xhpc_composerid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "composerid");
//xhpc_targetid = GlobusHttpHelper.GetParamValue(pageSource_HomeData, "xhpc_targetid");
#endregion
string composer_session_id = "";
string tempresponse1 = "";
///temp post
{
string source = "";
string profile_id = "";
string gridID = "";
string qn = string.Empty;
try
{
string Url = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=139180732957326&__user=100007423262870&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=AQCehhQg&__rev=1062230";
string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user=" + UsreId + "&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501"; //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user=" + UsreId + "&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679";
// string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user=" + UsreId + "&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165";
string res11 = pageSource_Home;//HttpHelper.postFormData(new Uri(Url), posturl1);
try
{
source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
}
catch { }
try
{
profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
if (profile_id.Contains(","))
{
profile_id = ParseEncodedJson(res11, "profile_id");
}
//"gridID":
}
catch { }
try
{
gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
}
catch { }
try
{
composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
}
catch { }
try
{
if (string.IsNullOrEmpty(composer_session_id))
{
composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
}
}
catch { }
try
{
qn = getBetween(res11, "qn\\\" value=\\\"", "\\\" \\/>");
}
catch { }
}
//.........这里部分代码省略.........
示例7: ExtractIDUsingGraphAPI
public string ExtractIDUsingGraphAPI(string URL, ref GlobusHttpHelper HttpHelper)
{
string profileID = string.Empty;
try
{
if (URL.Contains("id="))
{
profileID = URL.Replace(URL.Remove(URL.IndexOf("id=") + "id=".Length), "");
return profileID;
}
int startIndx = URL.LastIndexOf("/");
string name = URL.Substring(startIndx).Replace("/", "");
string response = HttpHelper.getHtmlfromUrl(new Uri("https://graph.facebook.com/" + name));
profileID = ParseJsonGraphAPI(response, "id");
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
return profileID;
}
示例8: GetAllFriends
public static List<string> GetAllFriends(ref GlobusHttpHelper globusHttpHelper, string userId)
{
List<string> finalList_Friends = new List<string>();
List<string> list_finalFriendsID = new List<string>();
try
{
string pgSource_Friends = globusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/profile.php?id=" + userId + "&sk=friends"));////fbProfileUrl = "https://www.facebook.com/profile.php?id=";
string[] Friends = Regex.Split(pgSource_Friends, "user.php");
ParseFriendIDs(Friends, finalList_Friends);
List<string> lstnewfriendid = new List<string>();
// {"collection_token":"1220529617:2356318349:2","cursor":"MDpub3Rfc3RydWN0dXJlZDoxMDAwMDA5MjM1MTg5MjY=","tab_key":"friends","profile_id":1220529617,"overview":false,"ftid":null,"order":null,"sk":"friends"}
string collection_token = "";
string cursor = "";
//check if all friends loaded
string patternAllFriendsLoaded = "\"TimelineAppCollection\",\"setFullyLoaded\",[],[\"pagelet_timeline_app_collection_";
int tempCount_AjaxRequests = 0;
do //
{
try
{
collection_token = "";
cursor = "";
string[] arry = Regex.Split(pgSource_Friends, "enableContentLoader");
if (arry.Length > 1)
{
try
{
string rawData = arry[1];
int startIndx_collection_token = rawData.IndexOf("pagelet_timeline_app_collection_") + "pagelet_timeline_app_collection_".Length;
int endIndx_collection_token = rawData.IndexOf("\"", startIndx_collection_token);
collection_token = rawData.Substring(startIndx_collection_token, endIndx_collection_token - startIndx_collection_token);
int startIndx_cursor = rawData.IndexOf(",\"", endIndx_collection_token) + ",\"".Length;
int endIndx_cursor = rawData.IndexOf("\"", startIndx_cursor);
cursor = rawData.Substring(startIndx_cursor, endIndx_cursor - startIndx_cursor);
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
string raw_data = "{\"collection_token\":\"" + collection_token + "\",\"cursor\":\"" + cursor + "\",\"tab_key\":\"friends\",\"profile_id\":" + userId + ",\"overview\":false,\"ftid\":null,\"order\":null,\"sk\":\"friends\"}";
string encoded_raw_data = Uri.EscapeDataString(raw_data);
string getURL_MoreFriendsAjax = "https://www.facebook.com/ajax/pagelet/generic.php/AllFriendsAppCollectionPagelet?data=" + encoded_raw_data + "&__user=" + userId + "&__a=1&__dyn=7n8ahyj2qmudwNAEU&__req=2";
string res_getURL_MoreFriendsAjax = globusHttpHelper.getHtmlfromUrl(new Uri(getURL_MoreFriendsAjax));
pgSource_Friends = res_getURL_MoreFriendsAjax;
string[] arry_UserData = Regex.Split(pgSource_Friends, "user.php");
ParseFriendIDs(arry_UserData, finalList_Friends);
tempCount_AjaxRequests++;
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
} while ((collection_token != "" && cursor != "") || tempCount_AjaxRequests < 15 || pgSource_Friends.Contains(patternAllFriendsLoaded));
finalList_Friends.ForEach(delegate(String friendID)
{
if (friendID.Contains("&"))
{
friendID = friendID.Remove(friendID.IndexOf("&"));
}
list_finalFriendsID.Add(friendID);
});
list_finalFriendsID = list_finalFriendsID.Distinct().ToList();
}
catch (Exception ex)
{
GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
return list_finalFriendsID;
}
示例9: RequestJSCSSIMG
public static void RequestJSCSSIMG(string pageSource, ref GlobusHttpHelper HttpHelper)
{
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
List<string> listURLs = new List<string>();
//CSS Request
foreach (string item in GetHrefsFromString(pageSource))
{
if (item.Contains(".css"))
{
string cssSource = item.Replace(" ", "").Trim();
try
{
//string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource));
listURLs.Add(cssSource);
}
catch (Exception)
{
Thread.Sleep(500);
try
{
//string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource));
string res = HttpHelper.getHtmlfromUrl(new Uri(cssSource));
}
catch (Exception)
{
}
}
}
}
//JS Request
string[] scriptArr = Regex.Split(pageSource, "/script>");
foreach (string item in scriptArr)
{
try
{
if (item.Contains("static.ak.") || item.Contains("profile.ak."))
{
int startIndx = item.LastIndexOf("src=") + "src=".Length + 1;
int endIndx = item.IndexOf(">", startIndx) - 1;
string jsSource = item.Substring(startIndx, endIndx - startIndx);
//if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
{
try
{
//string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
listURLs.Add(jsSource);
}
catch (Exception)
{
Thread.Sleep(500);
try
{
//string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
}
catch (Exception)
{
}
}
}
}
}
catch (Exception)
{
}
}
string[] moreScriptArray = Regex.Split(pageSource, "\"src\":");
foreach (string item in moreScriptArray)
{
try
{
int startIndx = 1;
int endIndx = item.IndexOf("\"", startIndx);
string jsSource = item.Substring(startIndx, endIndx - startIndx).Replace("\\", "");
if (jsSource.Contains(".js"))
{
//string res = HttpHelper.getHtmlfromUrl(new Uri(jsSource));
listURLs.Add(jsSource);
}
}
catch (Exception)
{
}
}
///IMG Request
string[] imageArr = Regex.Split(pageSource, "<img");
foreach (string item in imageArr)
{
try
{
if (item.Contains("static.ak.") || item.Contains("profile.ak."))
{
int startIndx = item.IndexOf("src=") + "src=".Length + 1;
int endIndx = item.IndexOf("\"", startIndx + 1);
//.........这里部分代码省略.........
示例10: AddSpecificGroupUserWithExcelInput
public Dictionary<string, string> AddSpecificGroupUserWithExcelInput(ref GlobusHttpHelper HttpHelper, string UserID, string gid)
{
string endName = string.Empty;
string DeegreeConn = string.Empty;
string endKey = string.Empty;
string Locality = string.Empty;
string Val_sourceAlias = string.Empty;
string Val_key = string.Empty;
string Val_defaultText = string.Empty;
string Name = string.Empty;
string Val_CsrToken = string.Empty;
string Val_Subject = string.Empty;
string Val_greeting = string.Empty;
string Val_AuthToken = string.Empty;
string Val_AuthType = string.Empty;
string val_trk = string.Empty;
string Val_lastName = string.Empty;
string html = string.Empty;
string Title = string.Empty;
#region Data Initialization
string csrfToken = string.Empty;
string pageSource = string.Empty;
string[] RgxSikValue = new string[] { };
string[] RgxPageNo = new string[] { };
string sikvalue = string.Empty;
int counter = 0;
#endregion
try
{
GroupSpecMem.Clear();
string pageSource1 = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
if (pageSource1.Contains("csrfToken"))
{
csrfToken = pageSource1.Substring(pageSource1.IndexOf("csrfToken"), 50);
string[] Arr = csrfToken.Split('>');
csrfToken = Arr[0];
csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script src", string.Empty);
csrfToken = csrfToken.Trim();
}
string[] RgxGroupData = new string[] { };
foreach (string[] itemArr in msgGroupMem_excelData)
{
try
{
pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?viewMembers=&gid=" + gid));
}
catch { }
string group = string.Empty;
string mem = string.Empty;
try
{
group = itemArr[0].ToString();
mem = itemArr[1].ToString();
endKey = itemArr[1].ToString();
}
catch { }
if (!string.IsNullOrEmpty(group) || !string.IsNullOrEmpty(mem))
{
try
{
RgxSikValue = System.Text.RegularExpressions.Regex.Split(pageSource, "sik");
}
catch { }
try
{
sikvalue = RgxSikValue[1].Split('&')[0].Replace("=", string.Empty);
}
catch { }
try
{
if (NumberHelper.ValidateNumber(sikvalue))
{
sikvalue = sikvalue.Split('\"')[0];
}
else
{
sikvalue = sikvalue.Split('\"')[0];
}
}
catch
{
sikvalue = sikvalue.Split('\"')[0];
}
string postdata = "csrfToken=" + csrfToken + "&searchField=" + Uri.EscapeDataString(mem) + "&searchMembers=submit&searchMembers=Search&gid=" + gid + "&goback=.gna_" + gid + "";
#region Commented old code
try
{
//.........这里部分代码省略.........
示例11: LoginHttpHelper_Checker
public void LoginHttpHelper_Checker(ref GlobusHttpHelper HttpHelper)
{
try
{
this.HttpHelper = HttpHelper;
//Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + SearchCriteria.LoginID + " ]");
Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + accountUser + " ]");
Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]");
Url = "https://www.linkedin.com/";
string pageSrcLogin = string.Empty;
int ProxyPort = 0;
if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort))
{
ProxyPort = int.Parse(proxyPort);
}
pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, ProxyPort, proxyUserName, proxyPassword);
string postdata = string.Empty;
string postUrl = string.Empty;
string ResLogin = string.Empty;
string csrfToken = string.Empty;
string regCsrfParam = string.Empty;
string sourceAlias = string.Empty;
if (pageSrcLogin.Contains("csrfToken"))
{
try
{
int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\"");
string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", "");
int endIndex = start.IndexOf("\" ");
string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim();
csrfToken = end;
//csrfToken = csrfToken;
}
catch (Exception ex)
{
}
}
try
{
if (csrfToken.Contains("&"))
{
string[] Arr = csrfToken.Split('&');
csrfToken = Arr[0].Replace("\"", string.Empty);
}
}
catch { }
if (pageSrcLogin.Contains("sourceAlias"))
{
sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
string[] Arr = sourceAlias.Split('"');
sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty).Trim();
}
try
{
int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam");
if (SourceAliasStart > 0)
{
try
{
regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100);
string[] Arr = regCsrfParam.Split('"');
regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty);
}
catch
{
}
}
}
catch { }
postUrl = "https://www.linkedin.com/uas/login-submit";
postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(accountUser) + "&session_password=" + Uri.EscapeDataString(accountPass) + "&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
try
{
ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, ProxyPort, proxyUserName, proxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", "");
}
catch { }
//if (GroupStatus.GrouppageSourcewithProxy == string.Empty)
//{
// GroupStatus.GrouppageSourcewithProxy = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
//}
string ImageUrl = string.Empty;
string captchaText = string.Empty;
string captchachallengeid = string.Empty;
string dts = string.Empty;
//.........这里部分代码省略.........
示例12: UrlShare
public void UrlShare(ref GlobusHttpHelper objGlobusHttpHelper, string username, string password, string proxyAddress, string proxyPort, string proxyUserName, string proxyPassword, string webUrlAndText)
{
try
{
if (_isStop_Share)
{
return;
}
lstShareThread.Add(Thread.CurrentThread);
lstShareThread = lstShareThread.Distinct().ToList();
Thread.CurrentThread.IsBackground = true;
AddLoggerShare("[ " + DateTime.Now + " ] => [ Starting process to share the link on account : " + username + " ]");
string getResponseWebUrl = string.Empty;
string shareUrl = string.Empty;
string csrfToken = string.Empty;
string contentId = string.Empty;
string contentUrl = string.Empty;
string contentResolvedUrl = string.Empty;
string contentType = string.Empty;
string contentTitle = string.Empty;
string contentDescription = string.Empty;
string mentions = "%5B%5D";
string shareText = string.Empty;
string webUrl = string.Empty;
string distNetwork = string.Empty;
try
{
if (webUrlAndText.Contains(";"))
{
string[] url_Text_Split = Regex.Split(webUrlAndText, ";");
webUrl = url_Text_Split[0];
shareText = url_Text_Split[1];
}
else
{
webUrl = webUrlAndText;
}
}
catch
{ }
try
{
if (!webUrl.Contains("http"))
{
webUrl = "http://" + webUrl;
}
}
catch
{ }
getResponseWebUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(webUrl));
shareUrl = "https://www.linkedin.com/sharing/share?url=" + Uri.EscapeDataString(webUrl) + "&trk=LI_BADGE";
string getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
if (!getResponseShareUrl.Contains("csrfToken"))
{
Thread.Sleep(3000);
getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
if (!getResponseShareUrl.Contains("csrfToken"))
{
Thread.Sleep(3000);
getResponseShareUrl = objGlobusHttpHelper.getHtmlfromUrl(new Uri(shareUrl));
}
}
csrfToken = getBetween(getResponseShareUrl, "\"csrfToken\":\"", "\"");
contentId = getBetween(getResponseShareUrl, "name=\"content.id\" value=\"", "\"");
contentUrl = getBetween(getResponseShareUrl, "name=\"content.url\" value=\"", "\"");
contentResolvedUrl = getBetween(getResponseShareUrl, "name=\"content.resolvedUrl\" value=\"", "\"");
contentType = getBetween(getResponseShareUrl, "name=\"contentType\" value=\"", "\"");
contentTitle = getBetween(getResponseShareUrl, "name=\"content.title\" value=\"", "\"");
distNetwork = "PUBLIC";
string webActionTrackUrl = "https://www.linkedin.com/lite/web-action-track?csrfToken=" + Uri.EscapeDataString(csrfToken);
string webActionPostData = "pkey=cws-share-widget&tcode=shr-unwnd-sccss&plist=";
string postResponseWebAction = objGlobusHttpHelper.postFormData(new Uri(webActionTrackUrl), webActionPostData);
string postResponseInfluencer = objGlobusHttpHelper.postFormData(new Uri("https://www.linkedin.com/nhome/influencer-entitlement"), string.Empty);
string finalPostUrl = "https://www.linkedin.com/sharing/share?trk=LI_BADGE";
string postDataFinalPost = "csrfToken=" + csrfToken + "&content.id=" + contentId + "&content.url=" + Uri.EscapeDataString(contentUrl) + "&content.resolvedUrl=" + Uri.EscapeDataString(contentResolvedUrl) + "&contentType=" + contentType + "&content.title=" + contentTitle + "&content.description=" + contentDescription + "&mentions=" + mentions + "&shareText=" + shareText.Replace(" ", "+") + "&dist.networks%5B0%5D=" + distNetwork;
string responseFinalPost = objGlobusHttpHelper.postFormData(new Uri(finalPostUrl), postDataFinalPost);
if (responseFinalPost.Contains("\"status\":\"SUCCESS\""))
{
AddLoggerShare("[ " + DateTime.Now + " ] => [ Successfully shared URL" + shareUrl + " on the account : " + username + " ]");
}
else
{
AddLoggerShare("[ " + DateTime.Now + " ] => [ Sharing unsuccessful URL" + shareUrl + " on the account : " + username + " ]");
}
}
catch
{ }
}
示例13: PostAddMembers
public Dictionary<string, string> PostAddMembers(ref GlobusHttpHelper HttpHelper, string user)
{
try
{
string MemId = string.Empty;
string MemFName = string.Empty;
string MemLName = string.Empty;
string MemFullName = string.Empty;
string pageSource = string.Empty;
string Name = string.Empty;
int start1 = 0;
#region old code
//MemberDtl.Clear();
//string pageGetreq = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/groups?gid=28410&csrfToken=ajax%3A1826913778783200924"));
//http://www.linkedin.com/connections2?displayFilteredConns=&fetchConnsFromDB=false
#endregion
//string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections2?displayFilteredConns"));
//string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/connections"));
//string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start=0&count=10"));
do
{
pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/contacts/api/contacts/?start="+start1+"&count=10"));
//string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{"");
string[] RgxGroupData = System.Text.RegularExpressions.Regex.Split(pageSource, "{\"name\":");
foreach (var Members in RgxGroupData)
{
try
{
if (Members.Contains(", \"id\":"))
{
int startindex = Members.IndexOf(", \"id\":");
string start = Members.Substring(startindex);
int endIndex = start.IndexOf("}");
MemId = start.Substring(0, endIndex).Replace(""", string.Empty).Replace("id", string.Empty).Replace(",", string.Empty).Replace(":", string.Empty).Replace("li_",string.Empty).Replace(", \"title\"",string.Empty).Replace("\"",string.Empty).Trim();
MemId = user + ':' + MemId;
string Fname = string.Empty;
string Lname = string.Empty;
try
{
int StartIndex = Members.IndexOf(""firstName":"");
if (StartIndex > 0)
{
string Start = Members.Substring(StartIndex).Replace(""firstName":"", "");
int EndIndex = Start.IndexOf("",");
string End = Start.Substring(0, EndIndex);
Fname = End;
}
}
catch (Exception ex)
{
}
try
{
int StartIndex = Members.IndexOf(""lastName":"");
if (StartIndex > 0)
{
string Start = Members.Substring(StartIndex).Replace(""lastName":"", "");
int EndIndex = Start.IndexOf("",");
string End = Start.Substring(0, EndIndex);
Lname = End;
}
}
catch (Exception ex)
{
}
try
{
int StartIndex = Members.IndexOf("\"");
if (StartIndex > 0)
{
string Start = Members.Substring(StartIndex).Replace(""firstName":"", "");
int EndIndex = Start.IndexOf(", \"title\"");
string End = Start.Substring(0, EndIndex).Replace(", \"title\"",string.Empty).Replace("\"",string.Empty).Trim();
Name = End;
}
}
catch (Exception ex)
{
}
//MemFullName = Fname + " " + Lname;
MemFullName = Name;
#region old code
//int startindex1 = Members.IndexOf("formattedName");
//string start1 = Members.Substring(startindex1);
//int endIndex1 = start1.IndexOf("}");
//MemFullName = start1.Substring(0, endIndex1).Replace("formattedName", string.Empty).Replace(""", string.Empty).Replace(":", string.Empty).Trim();
//.Replace(""", string.Empty).Replace(":", string.Empty).Replace(",", string.Empty).Trim();
//":"agrawal, gaurav"
//int startindex2 = Members.IndexOf("lastName");
//string start2 = Members.Substring(startindex2);
//.........这里部分代码省略.........
示例14: PostCreateGroupNames
public Dictionary<string, string> PostCreateGroupNames(ref GlobusHttpHelper HttpHelper, string user)
{
try
{
string pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/"));
if (pageSource == "")
{
Thread.Sleep(2000);
pageSource = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/myGroups?trk=nav_responsive_sub_nav_groups"));
}
string[] RgxGroupData = Regex.Split(pageSource, "media-content");
foreach (var GrpName in RgxGroupData)
{
string endName = string.Empty;
string endKey = string.Empty;
try
{
if (GrpName.Contains("<!DOCTYPE html>") || GrpName.Contains("Membership Pending"))
{
continue;
}
if (GrpName.Contains("<a href=\"/groups/") || (GrpName.Contains("<a href=\"/groups?")))
{
if ((GrpName.Contains("public")))
{
try
{
int startindex = GrpName.IndexOf("class=\"public\"");
string start = GrpName.Substring(startindex);
int endIndex = start.IndexOf("</a>");
endName = start.Substring(0, endIndex).Replace("title", string.Empty).Replace("=", string.Empty).Replace(">", string.Empty).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("\"", string.Empty).Replace("&", "&").Replace("classpublic", string.Empty).Replace(""", "'").Replace(":",";").Replace("This is an open group", string.Empty);
endName = endName + ':' + user;
}
catch (Exception ex)
{
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update1 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
}
try
{
endKey = "";
int startindex1 = GrpName.IndexOf("group");
string start1 = GrpName.Substring(startindex1);
int endIndex1 = start1.IndexOf("?");
endKey = start1.Substring(0, endIndex1).Replace("groups", string.Empty).Replace("/", string.Empty).Replace("<a href=", string.Empty).Replace("\"", string.Empty);
if (endKey == string.Empty)
{
//;gid=846797&
startindex1 = GrpName.IndexOf("gid=");
start1 = GrpName.Substring(startindex1);
endIndex1 = start1.IndexOf("&");
endKey = start1.Substring(0, endIndex1).Replace("gid=", string.Empty).Trim();
if (!NumberHelper.ValidateNumber(endKey))
{
try
{
endKey = endKey.Split('\"')[0];
}
catch { }
}
}
}
catch (Exception ex)
{
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update2 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
}
if (endKey.Contains("analyticsURL"))
{
continue;
}
if (endKey == string.Empty)
{
try
{
int startindex2 = GrpName.IndexOf("gid=");
string start2 = GrpName.Substring(startindex2);
int endIndex2 = start2.IndexOf("&");
endKey = start2.Substring(0, endIndex2).Replace("gid", string.Empty).Replace("=", string.Empty);
}
catch (Exception ex)
{
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> GroupStatus3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update3 --> PostCreateGroupNames() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
}
}
else
{
string[] endKeyLast = endKey.Split('-');
//.........这里部分代码省略.........
示例15: PostAttachLinkGroupUpdate
public void PostAttachLinkGroupUpdate(ref GlobusHttpHelper HttpHelper, List<string> selectedItems, object parameter, int mindelay, int maxdelay)
{
string postdata = string.Empty;
string referal = string.Empty;
string postUrl = string.Empty;
string ResLogin = string.Empty;
string csrfToken = string.Empty;
string sourceAlias = string.Empty;
string ReturnString = string.Empty;
string PostGrpAttachLink = string.Empty;
string PostGrpKey = string.Empty;
string Poststatus = string.Empty;
try
{
string MessageText = string.Empty;
string PostedMessage = string.Empty;
string pageSource = string.Empty;
Array paramsArray = (Array)parameter;
string user = string.Empty;
try
{
user = paramsArray.GetValue(1).ToString();
}
catch { }
pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
if (pageSource.Contains("csrfToken"))
{
string pattern = @"\";
csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
string[] Arr = csrfToken.Split('&');
csrfToken = Arr[0];
csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty);
csrfToken = csrfToken.Replace(pattern, string.Empty.Trim());
}
if (pageSource.Contains("sourceAlias"))
{
string pattern1 = @"\";
sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
string[] Arr = sourceAlias.Split('"');
sourceAlias = Arr[2];
sourceAlias = sourceAlias.Replace(pattern1, string.Empty.Trim());
}
try
{
int counter = 0;
foreach (var Itegid in selectedItems)
{
counter = counter + 1;
try
{
lock (Locked_Que_GrpAttachLink_Post)
{
if (Que_GrpAttachLink_Post.Count > 0)
{
try
{
PostGrpAttachLink = Que_GrpAttachLink_Post.Dequeue();
}
catch { }
}
else
{
PostGrpAttachLink = AttachLink_Post;
}
}
string[] grpDisplay = Itegid.Split(':');
string GrpName = Itegid.ToString().Replace(",", ":").Replace("[", string.Empty).Replace("]", string.Empty).Trim();
string[] PostGid = GrpName.Split(':');
string Gid = string.Empty;
try
{
if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
{
Gid = PostGid[1].Trim();
}
else if (NumberHelper.ValidateNumber(PostGid[2].Trim()))
{
Gid = PostGid[2].Trim();
}
else if (NumberHelper.ValidateNumber(PostGid[3].Trim()))
{
Gid = PostGid[3].Trim();
}
else if (NumberHelper.ValidateNumber(PostGid[4].Trim()))
{
Gid = PostGid[4].Trim();
}
else if (NumberHelper.ValidateNumber(PostGid[5].Trim()))
{
//.........这里部分代码省略.........