本文整理汇总了C#中System.Collections.ArrayList.InsertRange方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList.InsertRange方法的具体用法?C# System.Collections.ArrayList.InsertRange怎么用?C# System.Collections.ArrayList.InsertRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了System.Collections.ArrayList.InsertRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLeadsForLocanto
public void GetLeadsForLocanto(string statecode)
{
string pages = ""; int page = 0;
//string mainurl = "http://www.locanto.com/Vehicles/H/?professional=0&page=";
string mainurl = "http://" + statecode + ".locanto.com/Vehicles/H/";
if (stoplocanto)
{
FillCurrentPageData(mainurl);
Regex regexindividual31 = new Regex("<div style=\"padding:3px 0 0 240px;\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist31 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec31 = null;
regexindividualCollec31 = regexindividual31.Matches(str);
individualCararraylist31.Clear();
individualCararraylist31.InsertRange(individualCararraylist31.Count, regexindividualCollec31);
if (individualCararraylist31.Count > 0)
{
pages = individualCararraylist31[0].ToString().Replace("<div style=\"padding:3px 0 0 240px;\">", "");
pages = Regex.Replace(pages, "[^0-9]", "");
pages = (int.Parse(pages) / 25).ToString();
page = int.Parse(pages);
if (page > 79)
page = 79;
}
for (int p = 0; p <= page; p++)
{
if (stoplocanto)
{
#region tot
FillCurrentPageData(mainurl + p + "/");
Regex regexindividual3 = new Regex("<span class=\"textHeader \">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist3 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec3 = null;
regexindividualCollec3 = regexindividual3.Matches(str);
individualCararraylist3.Clear();
individualCararraylist3.InsertRange(individualCararraylist3.Count, regexindividualCollec3);
for (int dj = 0; dj < individualCararraylist3.Count; dj++)
{
string desc = ""; string title = ""; string price = "";
string pubDate = ""; string name = "";
string location = ""; string place = ""; string phno = string.Empty;
string state = ""; string city = "";
#region fetch
string url = individualCararraylist3[dj].ToString();
url = url.Substring(url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Substring(0, url.IndexOf("onclick"));
//url = url.Replace(">", "");
url = url.Replace("\"", "");
title = individualCararraylist3[dj].ToString();
title = title.Replace("<span class=\"textHeader \">", "");
title = title.Substring(title.IndexOf(">"));
title = title.Replace(">", "").Trim();
if (title.IndexOf("<span") != -1)
{
//location = title.Substring(title.IndexOf("<span"));
title = title.Substring(0, title.IndexOf("<span"));
//location = location.Replace("<span class=\"textLoc\"", "");
//location = location.Replace("</span", "").Trim();
//if (location.IndexOf(",") != -1)
// city = location.Substring(0, location.IndexOf(","));
//else
// city = location;
//state = location.Replace(city, "");
//state = state.Replace(",", "");
//state = Regex.Replace(state, "[0-9]", "");
}
else
title = title.Replace("</span", "");
//location = title.Substring(title.IndexOf("<span"));
FillCurrentPageData(url);
Regex r3 = new Regex("<div class=\"user_content\">(.*?)</div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
for (int x = 0; x < al3.Count; x++)
{
desc = al3[x].ToString();
desc = desc.Replace("<div class=\"user_content\">", "");
desc = desc.Replace("</div>", "");
//desc = desc.Substring(0, desc.IndexOf("<!-- AddThis Button BEGIN -->"));
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
//.........这里部分代码省略.........
示例2: GetLeadsForOodle
public void GetLeadsForOodle(string state)
{
int varcount = 0;
string mainurl = "http://cars.oodle.com/used-cars/for-sale/" + state + "/condition_used/?o=";
int res = 0;
for (int i = 0; i <= 267; i++)
{
res = i * 15;
string url1 = mainurl + res;
FillCurrentPageData(url1);
//url list
Regex r11 = new Regex("<span class=\"listing-title\">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al11 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc11 = null;
mc11 = r11.Matches(str);
al11.Clear();
al11.InsertRange(al11.Count, mc11);
if (al11.Count > 0)
{
if (stopoodle)
{
for (int k = 0; k < al11.Count; k++)
{
string sname = ""; string title = ""; string url = "";
string price = ""; string phno = "";
string location = ""; string description = "";
string statename = ""; string city = "";
if (stopoodle)
{
#region data
if (al11[k].ToString().IndexOf("href=") != -1)
url = al11[k].ToString().Substring(al11[k].ToString().IndexOf("href="));
if(url.IndexOf("title=\"\"") !=-1)
url = url.Substring(0, url.IndexOf("title=\"\""));
url = url.Replace(",,", "");
url = url.Replace("href=", "");
url = url.Replace("\"", "");
url = "http://cars.oodle.com" + url;
FillCurrentPageData(url);
//seller-name
Regex r1 = new Regex("<span id=\"seller-name\">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (al1.Count > 0)
{
for (int j = 0; j < al1.Count; j++)
{
sname = al1[j].ToString();
if (sname.IndexOf("</a>") != -1)
{
sname = sname.Substring(0, sname.IndexOf("</a>"));
sname = sname.Replace("</a>", "");
sname = sname.Substring(sname.LastIndexOf(">"));
sname = sname.Replace(">", "");
}
else
{
sname = sname.Replace("<span>", "");
sname = sname.Replace("</span>", "");
}
}
}
//title
Regex r2 = new Regex("<h2 id=\"detail-title-text\">(.*?)</h2>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
for (int j = 0; j < al2.Count; j++)
{
title = al2[j].ToString();
title = title.Replace("<h2 id=\"detail-title-text\">", "");
title = title.Replace("</h2>", "");
title = title.Replace("\t", "").Trim();
}
}
//price
Regex r3 = new Regex("<div id=\"listing-price\">(.*?)</div>(.*?)</div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
//.........这里部分代码省略.........
示例3: BackPage
public void BackPage(string state)
{
string phno = ""; string title = ""; string price = "";
int varcount = 0; string city = "";
for (int j = 1; j <= 100; j++)
{
string mainurl = "http://" + state.Replace(" ", "").ToLower() + ".backpage.com/AutosForSale/" + "?page=" + j;
FillCurrentPageData(mainurl);
Regex r1 = new Regex("<div class=\"cat\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (al1.Count > 0)
{
if (stopbackpage)
{
for (int i = 0; i < al1.Count; i++)
{
if (stopbackpage)
{
string url = al1[i].ToString();
url = url.Replace("<div class=\"cat\">", "");
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("<a href=", "");
url = url.Replace("\r", "");
url = url.Replace("\"", "").Trim();
FillCurrentPageData(url);
Regex r21 = new Regex("<div style=\"padding-left:2em;\">(.*?)</div>");
System.Collections.ArrayList al21 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc21 = null;
mc21 = r21.Matches(str);
al21.Clear();
al21.InsertRange(al21.Count, mc21);
if (al21.Count > 0)
{
city = al21[0].ToString();
city = city.Replace("<div style=\"padding-left:2em;\">", "");
city = city.Replace("• Location:", "").Trim();
city = city.Replace("</div>", "").Trim();
if (city.IndexOf(",") != -1)
{
city = city.Substring(0, city.IndexOf(","));
city = city.Replace(",", "");
}
}
Regex r2 = new Regex("<a class=\"h1link\" href=\"javascript:void;\">(.*?)</a>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
for (int k = 0; k < al2.Count; k++)
{
title = al2[k].ToString();
title = title.Replace("<a class=\"h1link\" href=\"javascript:void;\">", "");
title = title.Replace("</a>", "");
title = title.Replace("<h1>", "");
title = title.Replace("</h1>", "");
if (title.Contains("$"))
{
title = title.Replace(",", "");
price = title.Substring(0, title.IndexOf(" "));
}
}
}
Regex r3 = new Regex("<div class=\"postingBody\">(.*?)</div>(.*?)<p class=\"metaInfoDisplay\">");
//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
phno = "";
if (al3.Count > 0)
{
for (int l = 0; l < al3.Count; l++)
{
string desc = al3[l].ToString();
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
//.........这里部分代码省略.........
示例4: GetLeadsForGlobal
public void GetLeadsForGlobal()
{
int varcount = 0;
for (int a = 1; a <= 43; a++)
{
string mainurl = "http://usa.global-free-classified-ads.com/cars-cid-14-page-" + a;
FillCurrentPageData(mainurl);
//<span class="location">
Regex r2 = new Regex("<span class=\"location\">(.*?)</span>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
Regex regexindividual31 = new Regex("<h1>(.*?)</h1>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist31 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec31 = null;
regexindividualCollec31 = regexindividual31.Matches(str);
individualCararraylist31.Clear();
individualCararraylist31.InsertRange(individualCararraylist31.Count, regexindividualCollec31);
for (int p = 0; p < individualCararraylist31.Count; p++)
{
string desc = ""; string title = ""; string price = "";
string pubDate = ""; string name = "";
string location = ""; string place = ""; string phno = string.Empty;
string city = ""; string state = "";
string url = individualCararraylist31[p].ToString();
url = url.Substring(url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("\"", "");
location = al2[p].ToString().Replace("<span class=\"location\">", "");
location = location.Replace("</span>", "");
location = location.Replace("</a>", "");
if(location.IndexOf(">") != -1)
location = location.Substring(location.IndexOf(">"));
location = location.Replace("Cars", "");
location = location.Replace(">", "");
location = location.Replace(":", "");
if (location.IndexOf(",") != -1)
{
city = location.Substring(0, location.IndexOf(","));
state = location.Replace(city + ",", "");
if (state.IndexOf(",") != -1)
state = state.Substring(0, state.IndexOf(","));
}
else
{
state = location;
city = "";
}
FillCurrentPageData(url);
Regex r3 = new Regex("<div class=\"content_box_1\">(.*?)</div>");
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
for (int x = 0; x < al3.Count; x++)
{
if (al3[x].ToString().Contains("Seller's Comments and Description:"))
{
desc = al3[x].ToString();
desc = desc.Replace("<div class=\"user_content\">", "");
desc = desc.Replace("</div>", "");
desc = desc.Replace("<div class=\"content_box_1\">", "");
desc = desc.Replace("<h3>Seller's Comments and Description:</h3>", "");
desc = desc.Replace("<p>", "");
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
for (int ph = 0; ph < digits.Length; ph++)
{
if (digits[ph].Length == 10)
{
phno = digits[ph];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 3 && digits[ph + 2].Length == 4)
{
phno = digits[ph] + digits[ph + 1] + digits[ph + 2];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 7)
{
phno = digits[ph] + digits[ph + 1];
}
}
}
//.........这里部分代码省略.........
示例5: Claz
public void Claz(string cityname)
{
int varcount = 0;
string price = ""; string title = ""; string desc = "";
string PhoneNumber = ""; string city = ""; string url = ""; string state = ""; string loc = "";
string mainurl = "http://" + cityname + ".claz.org/classifieds/vehicles/cars?p=";
for (int u = 1; u <= 50; u++)
{
FillCurrentPageData(mainurl + u);
Regex r1 = new Regex("<div class=\"heading\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (al1.Count == 0)
return;
Regex r2 = new Regex("<div class=\"breadcrumbs\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
Regex r3 = new Regex("<div class=\"source\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
if (al1.Count > 0 && al2.Count > 0 && al3.Count > 0)
{
for (int i = 0; i < al1.Count; i++)
{
if (al1[i].ToString().IndexOf("title") != -1)
{
title = al1[i].ToString();
title = title.Substring(title.IndexOf("title"), title.IndexOf("onclick") - title.IndexOf("title"));
title = title.Replace("title", "");
title = title.Replace("onclick", "");
title = title.Replace("=", "");
title = title.Replace("\"", "").Trim();
}
if (al1[i].ToString().IndexOf("title") != -1 && al1[i].ToString().IndexOf("href") != -1)
{
url = al1[i].ToString().Substring(al1[i].ToString().IndexOf("href"), al1[i].ToString().IndexOf("title") - al1[i].ToString().IndexOf("href"));
url = url.Replace("href=", "");
url = url.Replace("\"", "").Trim();
}
if (al1[i].ToString().IndexOf("<div class=\"price\">") != -1)
{
price = al1[i].ToString().Substring(al1[i].ToString().IndexOf("<div class=\"price\">"));
price = price.Replace("<div class=\"price\">", "");
price = price.Replace("</div>", "");
}
if (al2[i].ToString().IndexOf("<a class=\"city\"") != -1)
{
loc = al2[i].ToString().Substring(al2[i].ToString().IndexOf("<a class=\"city\""));
loc = loc.Substring(0, loc.IndexOf("</a>"));
loc = loc.Substring(loc.LastIndexOf(">"));
loc = loc.Replace(">", "");
city = loc.Substring(0, loc.IndexOf(","));
city = city.Replace(",", "");
state = loc.Replace(city, "");
state = state.Replace(",", "");
}
if (al3[i].ToString().IndexOf("</span>") != -1)
{
PhoneNumber = al3[i].ToString().Substring(0, al3[i].ToString().IndexOf("</span>"));
PhoneNumber = PhoneNumber.Replace("</span>", "");
PhoneNumber = PhoneNumber.Substring(PhoneNumber.LastIndexOf(">"));
PhoneNumber = PhoneNumber.Replace(">", "");
PhoneNumber = PhoneNumber.Replace("-", "");
}
varcount++;
//objDal.saveClazLeads(title, price, city, PhoneNumber, url, desc);
objDal.SaveLeadsData("", "", title, PhoneNumber, price, url, "", state, city, "", "", "", "", desc, "", "", "", "", "", "", "", "");
Navigate.Text = varcount.ToString();
}
}
}
}
示例6: Ebayclassifieds
public void Ebayclassifieds(string statename)
{
if (stopebay)
{
int varcount = 0;
string sname = ""; string price = ""; string location = "";
string pho = ""; string desc = ""; string url = ""; string title = "";
string mainurl = "http://www.ebayclassifieds.com/state/";
string state = statename.ToLower();
if (state.Contains(" "))
state = state.Replace(" ", "+");
mainurl = mainurl + state;
FillCurrentPageData(mainurl);
Regex r1 = new Regex("<li>(.*?)</li>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (stopebay)
{
if (al1.Count > 0)
{
for (int i = 0; i < al1.Count; i++)
{
int page = 0;
string a = al1[i].ToString().Replace("<li>", "");
a = a.Substring(0, a.IndexOf(">"));
a = a.Replace("<a href=", "");
a = a.Replace("\"", "");
FillCurrentPageData(a + "cars/?catId=100028");
Regex r2 = new Regex("<span class=\"ec-breadcrumb\" style=\"padding-left: 5px;\">(.*?)</span>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
string res = al2[0].ToString();
res = Regex.Replace(res, "[A-Za-z]", "");
string[] res1 = Regex.Split(res, @"\D+");
page = (int.Parse(res1[res1.Length - 2]) / 24) + 1;
}
if (stopebay)
{
for (int j = 0; j <= page; j++)
{
if (stopebay)
{
#region ebay
FillCurrentPageData(a + "cars/?catId=100028&page=" + j);
Regex r3 = new Regex("<div class=\"ad-title\"><p>(.*?)</p></div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
if (al3.Count > 0)
{
for (int k = 0; k < al3.Count; k++)
{
url = al3[k].ToString();
url = url.Substring(url.IndexOf("href="), url.IndexOf("id=") - url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Replace("\"", "");
FillCurrentPageData(url);
Regex r4 = new Regex("<h1 id=\"ad-title\">(.*?)</span></h1>");
System.Collections.ArrayList al4 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc4 = null;
mc4 = r4.Matches(str);
al4.Clear();
al4.InsertRange(al4.Count, mc4);
if (al4.Count > 0)
{
for (int l = 0; l < al4.Count; l++)
{
string tot = al4[l].ToString();
if (tot.IndexOf("<span class=\"price\">") != -1)
{
title = tot.Substring(tot.IndexOf("<span>"), tot.IndexOf("<span class=\"price\">") - tot.IndexOf("<span>"));
tot = tot.Replace(title, "");
title = title.Replace("<span>", "");
title = title.Replace("</span>", "");
}
if (tot.IndexOf("<span class=\"location\">") != -1)
//.........这里部分代码省略.........
示例7: GetClassifiedsValleyLeads
public void GetClassifiedsValleyLeads()
{
string str = "";
for (int p = 1; p < 29; p++)
{
#region tot
FillCurrentPageData("http://www.classifiedsvalley.com/category/196/Cars/" + p + ".html");
Regex regexindividual1 = new Regex("<a (.*?)>(.*?)</a>");
System.Collections.ArrayList individualCararraylist1 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec1 = null;
regexindividualCollec1 = regexindividual1.Matches(str);
individualCararraylist1.Clear();
individualCararraylist1.InsertRange(individualCararraylist1.Count, regexindividualCollec1);
if (individualCararraylist1.Count > 0)
{
for (int dj = 11; dj < individualCararraylist1.Count; dj++)
{
#region fetch
string title = ""; string city = ""; string state = "";
string sname = ""; string price = "";
string desc = ""; string PhoneNumber = ""; string phDesc = "";
string url = individualCararraylist1[dj].ToString();
if (url.Contains("category") && url.Contains("listing"))
{
if (dj % 2 == 0)
{
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("<a href=", "");
//url = url.Replace(">", "");
url = url.Replace("\"", "");
url = "http://www.classifiedsvalley.com/" + url;
FillCurrentPageData(url);//"http://www.carposts.com/AutoDetail.php?AutoID=35488727"
//Regex regexindividual = new Regex("<h1 class=\"listing_title\">(.*?)</h1>");
//Regex regexindividual = new Regex("<h1 class=\"seller_username\"><a (.*?) class=\"display_ad_value\">(.*?)</a></h1>");
//Regex regexindividual = new Regex("<li class=\"value price\">(.*?)</li>");
//Regex regexindividual = new Regex("<div class=\"box_pad\">(.*?)</div>");
//Regex regexindividual = new Regex("<ul class=\"info\">(.*?)</ul>");
Regex r1 = new Regex("<h1 class=\"listing_title\">(.*?)</h1>");
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
for (int x = 0; x < al1.Count; x++)
{
title = al1[x].ToString();
title = title.Replace("</h1>", "");
title = title.Substring(title.LastIndexOf(">"));
title = title.Replace(">", "");
}
Regex r2 = new Regex("<h1 class=\"seller_username\"><a (.*?) class=\"display_ad_value\">(.*?)</a></h1>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
for (int x = 0; x < al2.Count; x++)
{
sname = al2[x].ToString();
sname = sname.Replace("</a>", "");
sname = sname.Replace("</h1>", "");
sname = sname.Substring(sname.LastIndexOf(">"));
sname = sname.Replace(">", "");
}
Regex r3 = new Regex("<li class=\"value price\">(.*?)</li>");
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
for (int x = 0; x < al3.Count; x++)
{
price = al3[x].ToString();
price = price.Replace("</li>", "");
price = price.Substring(price.LastIndexOf(">"));
price = price.Replace(">", ""); price = price.Replace("USD", "");
price = price.Replace("$", "");
}
Regex r4 = new Regex("<div class=\"box_pad\">(.*?)</div>");
System.Collections.ArrayList al4 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc4 = null;
mc4 = r4.Matches(str);
al4.Clear();
//.........这里部分代码省略.........
示例8: GetLeadsForcraigslist
public void GetLeadsForcraigslist(string StateN, string CityN, int StateID)
{
varcount = 0;
int urlNums = 26; int a = 0, b = 0; string Modellist1 = "";
string sprice = ""; string sPosting = " "; string CollectedFromState = "";
string CusEmailId = ""; string date = ""; string year = ""; string yearCar = "";
string mainURL = ConfigurationManager.AppSettings["MainUrlCraigslist"].ToString();
{
mainURL = "http://" + StateN + ".craigslist.org/cto";
}
if (stopclo)
{
for (int j = 0; j <= urlNums; j++)
{
try
{
if (stopclo)
{
#region if
a = (j) * 100;
if (CCityNames.Text != "")
{
if (a == 0)
{
mainURL = "http://" + CityN + ".craigslist.org/search/cto?query=&srchType=A&minAsk=2500";
// http://abilene.craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=
}
else
{
mainURL = "http://" + CityN + ".craigslist.org/search/cto?query=&srchType=A&minAsk=2500&s=" + a + "";
// http://abilene.craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=&s=100
}
}
else
{
mainURL = "http://" + StateN + ".craigslist.org/search/cto?query=&srchType=T&minAsk=2500";
}
FillCurrentPageData(mainURL);
String str = string.Empty;
Regex regexindividual = new Regex("<span class=\"pl\">(.*?)</span>(.*?)</span>(.*?)</span>(.*?)</span>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
if (individualCararraylist.Count > 0)
{
for (int x = 0; x < individualCararraylist.Count; x++)
{
if (stopclo)
{
#region if
Regex dateregex = new Regex("<span class=\"date\">(.*?)</span>");
System.Collections.ArrayList datelist = new System.Collections.ArrayList();
str = individualCararraylist[x].ToString();
str = str.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection dateregexmatch = null;
dateregexmatch = dateregex.Matches(str);
datelist.Clear();
datelist.InsertRange(datelist.Count, dateregexmatch);
for (int abc = 0; abc < datelist.Count; abc++)
{
date = datelist[abc].ToString().Replace("<span class=\"date\">", "");
date = date.Replace("</span>", "");
DateTime new1 = DateTime.Parse(date);
new1 = new1.Date + ts;
if (!(new1 >= edate && new1 <= sdate))
{
return;
}
else
{
#region for
String SubURL3 = individualCararraylist[x].ToString();
int tindex = SubURL3.IndexOf("<a href=");
int etindex = SubURL3.Length;
string SubURL1 = SubURL3.ToString().Substring(tindex, etindex - tindex);
int tindex1 = SubURL1.IndexOf("\"");
int etindex1 = SubURL1.IndexOf(">");
string SubURL2 = SubURL1.ToString().Substring(tindex1, etindex1 - tindex1);
string sMainUrl = SubURL2.Replace("\"", "");
sMainUrl = "http://" + CityN + ".craigslist.org" + sMainUrl;
FillCurrentPageData(sMainUrl);
string Details = string.Empty;
Regex CarData = new Regex("<section id=\"postingbody\">(.*?)</section>");
System.Collections.ArrayList individualpnslyvmailarraylistURL = new System.Collections.ArrayList();
Details = content;
Details = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualpnslyvmailCollecURL = null;
regexindividualpnslyvmailCollecURL = CarData.Matches(Details);
individualpnslyvmailarraylistURL.Clear();
individualpnslyvmailarraylistURL.InsertRange(individualpnslyvmailarraylistURL.Count, regexindividualpnslyvmailCollecURL);
string vehicleDesc = string.Empty;
if (individualpnslyvmailarraylistURL.Count != 0)
{
vehicleDesc = individualpnslyvmailarraylistURL[0].ToString().Replace("<section id=\"postingbody\">", "");
//.........这里部分代码省略.........
示例9: GetLeadsFromCarsSite
private void GetLeadsFromCarsSite( string state,string zipcode)
{
varcount = 0;
string year = ""; string make = ""; string description = ""; string seller = ""; string phno = ""; string price = ""; string mileage = "";
int result = 1;
int a = 0, b = 0; int year1 = 0;
string mainURL = ConfigurationManager.AppSettings["MainURLCarsSite"].ToString();
string sURL = string.Empty;
string resurl = "http://www.cars.com/for-sale/used/_/N-ma9Zm5d?PMmt=0-0-0&crSrtFlds=stkTypId-feedSegId&feedSegId=28705";
resurl = resurl + "&isDealerGrouping=false&rd=30&rpp=250&sf1Dir=DESC&sf1Nm=price&sf2Dir=ASC&sf2Nm=miles&rn=" + a + "";
resurl = resurl + "&stkTypId=28881&zc=" + txtZipCars.Text + "&slrTypeId=28879&searchSource=GN_REFINEMENT";
FillCurrentPageData(resurl);
String resstr = string.Empty;
Regex restest = new Regex("<div class=\"listingsResultNumber\" id=\"sp_lrn\">(.*?)</div>");
System.Collections.ArrayList restestlist = new System.Collections.ArrayList();
resstr = content;
resstr = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection restestmatch = null;
restestmatch = restest.Matches(resstr);
restestlist.Clear();
restestlist.InsertRange(restestlist.Count, restestmatch);
if (restestlist.Count > 0)
{
string results = restestlist[0].ToString();
results = Regex.Replace(results, @"\<.+?\>", "");
results = results.Substring(results.IndexOf("of"));
if(results.IndexOf("Vehicles") != -1)
results = results.Substring(0, results.IndexOf("Vehicles"));
else
results = results.Substring(0, results.IndexOf("Vehicle"));
results = results.Replace("of", "").Trim();
result = Convert.ToInt32(results);
result = (result / 250) + 1;
if (result > 19)
result = 19;
else if (result < 1)
result = 1;
}
try
{
if (stopcars)
{
for (int j = 1; j <= result; j++)
{
a = (j - 1) * 250;
if (txtZipCars.Text.Length == 4)
{
txtZipCars.Text = "0" + txtZipCars.Text;
}
//string sURL1 = "http://www.cars.com/for-sale/searchresults.action?sf1Dir=DESC&prMn=4000";
//sURL1 = sURL1 + "&rd=100000&zc=" + txtZipCars.Text + "&rd=30&PMmt=0-0-0&stkTypId=28881&slrTypeId=28879&sf2Dir=ASC";
//sURL1 = sURL1 + "&sf1Nm=price&sf2Nm=miles&rpp=250&feedSegId=28705&searchSource=UTILITY&crSrtFlds=stkTypId-feedSegId";
//sURL1 = sURL1 + "-pseudoPrice-slrTypeId&pgId=2102&rn=" + a + "";
//string sURL1 = "http://www.cars.com/for-sale/used/_/N-ma9Zm5d?feedSegId=28705&rpp=250&sf2Nm=miles&sf1Nm=price&sf2Dir=ASC";
//sURL1 = sURL1 + "&stkTypId=28881&PMmt=0-0-0&zc=" + txtZipCars.Text + "&rd=30&sf1Dir=DESC&searchSource=UTILITY";
//sURL1 = sURL1 + "&crSrtFlds=stkTypId-feedSegId&pgId=2102&rn=" + a + "";
string sURL1 = "http://www.cars.com/for-sale/used/_/N-ma9Zm5d?PMmt=0-0-0&crSrtFlds=stkTypId-feedSegId&feedSegId=28705";
sURL1 = sURL1 + "&isDealerGrouping=false&rd=30&rpp=250&sf1Dir=DESC&sf1Nm=price&sf2Dir=ASC&sf2Nm=miles&rn=" + a + "";
sURL1 = sURL1 + "&stkTypId=28881&zc=" + txtZipCars.Text + "&slrTypeId=28879&searchSource=GN_REFINEMENT";
FillCurrentPageData(sURL1);
String str = string.Empty;
Regex test = new Regex("<div class=\"row vehicle\"(.*?)>(.*?)</div>(.*?)</div>(.*?)</div>(.*?)</div>(.*?)</div>(.*?)</div>");
System.Collections.ArrayList testlist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection testmatch = null;
str = str.Substring(str.IndexOf("<div class=\"col38 no-padding\" id=\"resultswrapper\">"));
testmatch = test.Matches(str);
testlist.Clear();
testlist.InsertRange(testlist.Count, testmatch);
if (stopcars)
{
for (int i = 0; i < testlist.Count; i++)
{
if (stopcars)
{
string url1 = "";
string all = testlist[i].ToString();
//all=Regex.Replace(description, @"\<.+?\>", "");
all = all.Replace("&", "&");
all = all.Substring(all.IndexOf("<a name=\"&lid=md-ymmt\""));
string url = all.Substring(0, all.IndexOf(">"));
all = all.Replace(url, "");
url = url.Replace("<a name=\"&lid=md-ymmt\" rel=\"nofollow\" href=\"", "");
url = url.Replace("\"", "");
string carid = url.Substring(url.IndexOf("listingId="));
carid = carid.Substring(0, carid.IndexOf("&"));
carid = carid.Replace("listingId=", "").Trim();
url1 = "www.cars.com" + url;
all = all.Replace("\r", "");
if (all.Contains("<span class=\"modelYearSort\">"))
{
year = all.Substring(0, all.IndexOf("</span>"));
year = year.Replace("<span class=\"modelYearSort\">", "");
year = year.Replace(">", "").Trim();
all = all.Substring(all.IndexOf(year + "</span>"));
//.........这里部分代码省略.........
示例10: GetCarPostLeads
public void GetCarPostLeads(string statename,string zip)
{
string re = ""; string str = "";
if (zip.Length == 4)
zip = 0 + zip;
string state = statename.Substring(0, statename.IndexOf(","));
string city = statename.Replace(state, "");
city = city.Replace(",", "");
FillCurrentPageData("http://www.carposts.com/Results.php?Zip=" + zip + "&Distance=25&PerPage=500&Gallery=Yes");
Regex regexindividual1 = new Regex("<a (.*?)>(.*?)</a>");
System.Collections.ArrayList individualCararraylist1 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec1 = null;
regexindividualCollec1 = regexindividual1.Matches(str);
individualCararraylist1.Clear();
individualCararraylist1.InsertRange(individualCararraylist1.Count, regexindividualCollec1);
for (int dj = 2; dj <= individualCararraylist1.Count - 1; dj++)
{
string title1 = ""; string title2 = ""; string title3 = ""; string title4 = ""; string title5 = "";
string title6 = ""; string title7 = ""; string title8 = ""; string title9 = ""; string title10 = "";
string title11 = ""; string title12 = ""; //string zip = "";
try
{
#region getData
string url = individualCararraylist1[dj].ToString();
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("<a href=", "");
url = url.Replace(">", "");
url = url.Replace("'", "");
url = "http://www.carposts.com/" + url;
FillCurrentPageData(url);//"http://www.carposts.com/AutoDetail.php?AutoID=35488727"
Regex regexindividual = new Regex("<tr>(.*?)</tr>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
re = "";
for (int x = 0; x < individualCararraylist.Count; x++)
{
re = re + individualCararraylist[x].ToString() + '^';
re = re.Replace("<div><br /></div>", "");
re = re.Replace("<div>", "");
re = re.Replace("</div>", "");
re = re.Replace("<tr>", "");
re = re.Replace("</tr>", "");
re = re.Replace("colspan=2", "");
re = re.Replace("bgcolor=silver", "");
re = re.Replace("align=center", "");
re = re.Replace("</td>", "");
}
if (re.IndexOf("<font color=\"Red\">") != -1)
{
re = re.Substring(re.IndexOf("<font color=\"Red\">"));
}
else if (re.IndexOf("<font color=Red>") != -1)
{
re = re.Substring(re.IndexOf("<font color=Red>"));
}
string phone = Regex.Replace(re, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
string PhoneNumber = string.Empty;
for (int p = 0; p < digits.Length; p++)
{
if (digits[p].Length == 10)
{
PhoneNumber = digits[p];
}
else if (digits[p].Length == 3 && digits[p + 1].Length == 3 && digits[p + 2].Length == 4)
{
PhoneNumber = digits[p] + digits[p + 1] + digits[p + 2];
}
else if (digits[p].Length == 3 && digits[p + 1].Length == 7)
{
PhoneNumber = digits[p] + digits[p + 1];
}
}
if (re.IndexOf("<td ><a href=\"javascript:send") != -1)
{
re = re.Substring(0, re.IndexOf("<td ><a href=\"javascript:send"));
}
//re = Regex.Replace(re,"/<[^a-zA-Z0-9]*|[^a-zA-Z0-9]*>/g","");//(re,@"(?<!\w)#\w+", "");
re = re.Replace("<td >", "<td>"); re = re.Replace("<td >", "<td>");
string[] sep = { "<td>" };
string[] re1 = re.Split(sep, StringSplitOptions.None);
for (int jcvp = 0; jcvp < re1.Length; jcvp++)
{
if (re1[jcvp].Contains("For Sale:"))
{
if (title1 == "")
{
//.........这里部分代码省略.........
示例11: GetLeadsForcraigslistRVSAutoSelection
//.........这里部分代码省略.........
{
for (int j = 1; j <= urlNums; j++)
{
if (stopclrv)
{
a = (j - 1) * 100;
if (CCityNames.Text != "")
{
if (a == 0)
{
mainURL = "http://" + CityRV + ".craigslist.org/search/rvs?query=&srchType=A&minAsk=2500";
}
else
{
mainURL = "http://" + CityRV + ".craigslist.org/search/rvs?minAsk=2500&srchType=A&s=" + a + "";
}
}
else
{
// mainURL = "http://" + StateRV + ".craigslist.org/rvs/";
mainURL = "http://" + StateRV + ".craigslist.org/search/rva?query=&srchType=A&minAsk=2500";
// mainURL = "http://" + cmbState.Text + ".craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=";
}
FillCurrentPageData(mainURL);
String str = string.Empty;
Regex regexindividual = new Regex("<span class=\"pl\">(.*?)</span>(.*?)</span>(.*?)</span>(.*?)</span>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
for (int x = 0; x < individualCararraylist.Count; x++)
{
if (stopclrv)
{
Regex dateregex = new Regex("<span class=\"date\">(.*?)</span>");
System.Collections.ArrayList datelist = new System.Collections.ArrayList();
str = individualCararraylist[x].ToString();
str = str.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection dateregexmatch = null;
dateregexmatch = dateregex.Matches(str);
datelist.Clear();
datelist.InsertRange(datelist.Count, dateregexmatch);
for (int abc = 0; abc < datelist.Count; abc++)
{
date = datelist[abc].ToString().Replace("<span class=\"date\">", "");
date = date.Replace("</span>", "");
DateTime new1 = DateTime.Parse(date);
new1 = new1.Date + ts;
if (!(new1 >= edate && new1 <= sdate))
{
return;
}
else
{
#region for
String SubURL3 = individualCararraylist[x].ToString();
int tindex = SubURL3.IndexOf("<a href=");
int etindex = SubURL3.Length;
string SubURL1 = SubURL3.ToString().Substring(tindex, etindex - tindex);
int tindex1 = SubURL1.IndexOf("\"");
int etindex1 = SubURL1.IndexOf(">");
示例12: GetLeadsForcraigslistRVS
private void GetLeadsForcraigslistRVS()
{
int urlNums = 10;
int a = 0, b = 0;
string mainURL = ConfigurationManager.AppSettings["MainUrlCraigslist"].ToString();
//if (CCityNames.SelectedItem != null)
//{
// mainURL = "http://" + CCityNames.SelectedItem + ".craigslist.org/cgi-bin/autos.cgi?&category=cta/";
//}
//else
{
mainURL = "http://" + cmbState.Text + ".craigslist.org/cto";
}
for (int j = 1; j <= urlNums; j++)
{
a = (j - 1) * 100;
if (CCityNames.Text != "")
{
if (a == 0)
{
mainURL = "http://" + CCityNames.Text + ".craigslist.org/rvs/";
// mainURL = "http://" + CCityNames.Text + ".craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=";
// http://abilene.craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=
}
else
{
mainURL = "http://" + CCityNames.Text + ".craigslist.org/rvs/index" + a + ".html";
// mainURL = "http://" + CCityNames.Text + ".craigslist.org/search/cto?query=&srchType=T&minAsk=10000&maxAsk=&s=" + a + "";
// http://abilene.craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=&s=100
}
}
else
{
mainURL = "http://" + CCityNames.Text + ".craigslist.org/rvs/";
// mainURL = "http://" + cmbState.Text + ".craigslist.org/search/cto?query=&srchType=T&minAsk=4000&maxAsk=";
}
FillCurrentPageData(mainURL);
String str = string.Empty;
Regex regexindividual = new Regex("<p class=\"row\">(.*?)</p>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
for (int x = 0; x < individualCararraylist.Count; x++)
{
string snextURl = individualCararraylist[x].ToString();
char[] sep = { '<' };
string[] sSplit = snextURl.Split(sep);
string subURL = string.Empty;
subURL = sSplit[4].Replace("a href=\"", "");
// .Split("href=".ToString());
int index = subURL.IndexOf(">");
int Endindex = sSplit[2].IndexOf(">");
string sMainUrl = subURL.ToString().Substring(0, index);
sMainUrl = sMainUrl.Replace("\"", "");
System.Collections.ArrayList Modellist = new System.Collections.ArrayList();
Regex regexobjState = new Regex("<font size=\"-1\">(.*?)</font>");
str = snextURl;
str = snextURl.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualModel = null;
regexindividualModel = regexobjState.Matches(str);
Modellist.Clear();
Modellist.InsertRange(Modellist.Count, regexindividualModel);
string sModel = sSplit[4];
index = sModel.IndexOf(">");
sModel = sModel.Substring(index, sModel.Length - index);
sModel = sModel.Replace(">", "");
sModel = sModel.Replace("-", "");
string sPrice = sSplit[5].Replace("/a> \t\t\t ", "");
FillCurrentPageData(sMainUrl);
Regex regexindividual1 = new Regex("<div id=\"userbody\">(.*?)</div>");
System.Collections.ArrayList individualCararraylist1 = new System.Collections.ArrayList();
//.........这里部分代码省略.........
示例13: GetClassifiedsCitiLeads
public void GetClassifiedsCitiLeads()
{
string str = ""; string date = "";
for (int p = 1; p < 716; p++)
{
string mainurl = "http://www.classifiedsciti.com/cars-amp-bikes/cars/USA/" + p;
#region tot
FillCurrentPageData(mainurl);
Regex regexindividual3 = new Regex("<h2>(.*?)</h2>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist3 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec3 = null;
regexindividualCollec3 = regexindividual3.Matches(str);
individualCararraylist3.Clear();
individualCararraylist3.InsertRange(individualCararraylist3.Count, regexindividualCollec3);
Regex regexindividual = new Regex("<span class=\"post-date\">(.*?)</span>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
for (int y = 0; y < individualCararraylist.Count; y++)
{
date = individualCararraylist[y].ToString().Replace("<span class=\"post-date\">", "");
date = date.Replace("</span>", "");
string[] date1 = date.Split('-');
date = date1[1] + "-" + date1[0] + "-" + date1[2];
DateTime new1 = DateTime.Parse(date);
new1 = new1.Date + ts;
if (!(new1 >= edate && new1 <= sdate))
{
return;
}
else
{
string desc = ""; string title = ""; string details = "";
string pubDate = ""; string name = ""; string price = "";
string location = ""; string place = ""; string phno = string.Empty;
string city = ""; string state = "";
#region fetch
string url = individualCararraylist3[y].ToString();
url = url.Substring(url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Substring(0, url.IndexOf("rel"));
//url = url.Replace(">", "");
url = url.Replace("\"", "");
FillCurrentPageData(url);
Regex r1 = new Regex("<div>(.*?)<div class=\"addthis_toolbox addthis_default_style\">(.*?)</div>");
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
for (int x = 0; x < al1.Count; x++)
{
desc = al1[x].ToString();
desc = desc.Replace("<div>", "");
desc = desc.Replace("</div>", "");
desc = desc.Substring(0, desc.IndexOf("<!-- AddThis Button BEGIN -->"));
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
for (int ph = 0; ph < digits.Length; ph++)
{
if (digits[ph].Length == 10)
{
phno = digits[ph];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 3 && digits[ph + 2].Length == 4)
{
phno = digits[ph] + digits[ph + 1] + digits[ph + 2];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 7)
{
phno = digits[ph] + digits[ph + 1];
}
}
}
Regex r2 = new Regex("<p>(.*?)</p>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
//.........这里部分代码省略.........
示例14: GetLeadsForAutoTrades
//.........这里部分代码省略.........
string sURL = string.Empty;
//for (int s = 0; s < makeSet.Length; s++)
//{
// for (int r = 0; r < StartyearENDYear.Length; r++)
// {
for (int j = 1; j <= urlNums; j++)
{
int a = (j - 1) * 100;
int b = a + 1;
//sURL = "http://www.autotrader.com/fyc/searchresults.jsp?";
//sURL = sURL + "lastBeginningStartYear=" + lastBeginningYears + "&";
//sURL = sURL + "showZipError=y&search_lang=en&" + StartyearENDYear[r] + "&dma=" + sState + "&";
//sURL = sURL + "page_location=findacar%3A%3Aispsearchform&search_type=both&body_code=0";
//sURL = sURL + "&distance=0&default_sort=" + sort[1] + "&address=" + sPin + "&rdm=1306449843560&";
//sURL = sURL + "marketZipError=false&sort_type=1&make=" + makeSet[s] + "&num_records=100&";
//sURL = sURL + "seller_type=p&pager.offset=" + a + "&first_record=" + b;
string surlDummy = string.Empty;
surlDummy = " http://www.autotrader.com/fyc/searchresults.jsp?search_lang=en&start_year=1981&search_type=used";
surlDummy = surlDummy + "&distance=75&min_price=4000&rdm=1319191830824&marketZipError=false&sownerid=1389588&lastBeginningStartYear=";
surlDummy = surlDummy + "1981&end_year=2015&showZipError=n&dma=" + sState + "&page_location=findacar%3A%3Aispsearchform&body_code=0";
surlDummy = surlDummy + "&isFlashPlugin=true&address=" + sPin + "&sort_type=priceDESC&seller_type=p&num_records=25&pager.offset=" + b + "&";
surlDummy = surlDummy + "first_record=" + b + "";
FillCurrentPageData(surlDummy);
String str = string.Empty;
Regex regexindividual = new Regex("<div class=\"listing-details\">(.*?)</div>");
System.Collections.ArrayList individualCararraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualCollec = null;
regexindividualCollec = regexindividual.Matches(str);
individualCararraylist.Clear();
individualCararraylist.InsertRange(individualCararraylist.Count, regexindividualCollec);
for (int x = 0; x < individualCararraylist.Count; x++)
{
string snextURl = individualCararraylist[x].ToString();
snextURl = snextURl.Replace("<div class=\"listing-details\">", "");
snextURl = snextURl.Substring(0, snextURl.IndexOf("class"));
snextURl = snextURl.Replace("<a href=", "");
string sMainUrl = snextURl;
sMainUrl = mainURL + sMainUrl;
sMainUrl = sMainUrl.Replace("\"", "");
FillCurrentPageData(sMainUrl);
//FillCurrentPageData(snextURl);
string CustomerName = string.Empty;
string ModelName = string.Empty;
string ModelYear = string.Empty;
string PhoneNumber = string.Empty;
string PhoneNumber1 = string.Empty;
string Address1 = string.Empty;
string Address2 = string.Empty;
string Price = string.Empty;
//Phone Number
System.Collections.ArrayList PhoneNolist = new System.Collections.ArrayList();
Regex regexobjPhone = new Regex("<h3 id=\"private-seller-phone\" style=\"display:none;\">(.*?)</h3>");
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexindividualPhoneCollec = null;
regexindividualPhoneCollec = regexobjPhone.Matches(str);
PhoneNolist.Clear();
PhoneNolist.InsertRange(PhoneNolist.Count, regexindividualPhoneCollec);
System.Collections.ArrayList PhoneNolist1 = new System.Collections.ArrayList();
if (PhoneNolist.Count == 0)
示例15: getLeadsAutoTrades_CA
private void getLeadsAutoTrades_CA()
{
int urlNums = 100;
int a = 1, b = 0;
//// mainURL = "http://" + CStatesNames.SelectedItem + ".craigslist.org/cgi-bin/autos.cgi?&category=cta/";
string sURL = string.Empty;
for (int j = 1; j <= urlNums; j++)
{
b = (j - 1) * 25;
string URl = string.Empty;
//b=1975 Ontario a==1
//b=1200 a==1 Yukon
if (cmbAutoCA.Text == "British Columbia")
{
//URl = "http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=British+Columbia&cty=Vancouver&prv=British+Columbia&";
//URl = URl + "ctr=Canada&vpt=49.0673013708205%2c-123.50711590917%2c49.4535738591128%2c-122.721012424493%2c&dftC=True&rprv=True";
//URl = URl + "&pRng=4000%2c&adtype=Private&hprc=True&st=" + a + "&rcs=" + b + "";
URl = " http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=British+Columbia&cty=V";
URl = URl + " ancouver&prv=British+Columbia&ctr=Canada&vpt=49.0673013708205%2c-123.50711590917%2c49.4535738591128%2c-122.7210124";
URl = URl + " 24493%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True&st=" + a + "&rcs=" + b + "";
}
else if (cmbAutoCA.Text == "Alberta")
{
URl = "http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Alberta&cty=Calgary&prv=Alberta&ctr=Canada&vpt=50.85";
URl = URl + "19000273506%2c-114.471113982568%2c51.2381725156429%2c-113.655319163647%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=";
URl = URl + "True&st=" + a + "&rcs=" + b + "";
}
else if (cmbAutoCA.Text == "Manitoba")
{
URl = "www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Manitoba&cty=Winnipeg&prv=Manitoba&ctr=Canada&vpt=49.706361";
URl = URl + "1903236%2c-97.5389035793473%2c50.0926336786159%2c-96.7425078897288%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True";
URl = URl + "&st=" + a + "&rcs=" + b + "";
}
else if (cmbAutoCA.Text == "Ontario")
{
URl = " http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Ontario&cty=";
URl = URl + " Toronto&prv=Ontario&ctr=Canada&vpt=43.4168299973413%2c-79.8107645429352%2c43.8803573695361%2c-";
URl = URl + " 78.959906034976%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True&st=" + a + "&rcs=" + b + "";
//URl = "www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Ontario&cty=Toronto&prv=Ontario&ctr=Canada&vpt=43.416829997";
//URl = URl + "3413%2c-79.8107645429352%2c43.8803573695361%2c-78.959906034976%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True&st=";
//URl = URl + "" + a + "&rcs=" + b + "";
}
else if (cmbAutoCA.Text == "Yukon")
{
URl = " http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=YUKON&cty=:";
URl = URl + " Whitehorse&ctr=Canada&vpt=60.6648982323266%2c-135.205612854466%2c60.7769170596323%2c-1";
URl = URl + " 34.900747534535%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True&st=" + a + "&rcs=" + b + "";
//URl = "www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Yukon&cty=Whitehorse&ctr=Canada&vpt=60.6648982323266%2c-135";
//URl = URl + ".205612854466%2c60.7769170596323%2c-134.900747534535%2c&dftC=True&rprv=True&pRng=4000%2c&hprc=True&st=&st=" + a + "&rcs=" + b + "";
}
else if (cmbAutoCA.Text == "Saskatchewan")
{
URl = " http://www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=YUKON&cty=:";
URl = URl + " Whitehorse&ctr=Canada&vpt=60.6648982323266%2c-135.205612854466%2c60.7769170596323%2c-1";
URl = URl + " 34.900747534535%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc=True&st=" + a + "&rcs=" + b + "";
//URl = "www.autotrader.ca/a/pv/Used/all/all/all/?cat2=7&lloc=Saskatchewan&cty=Regina&prv=Saskatchewan&ctr=Canada&vpt=50.";
//URl = URl + "312902988279%2c-104.877451716832%2c50.5832934689313%2c-104.312896672548%2c&dftC=True&rprv=True&pRng=4000%2c&adtype=Private&hprc";
//URl = URl + "=True&st=" + a + "&rcs=" + b + "";
}
FillCurrentPageData(URl);
String str = string.Empty;
//Regex regexindividualURL = new Regex("<div class=\"used_result_container premium_result\">(.*?)</div>");
//System.Collections.ArrayList individualCararraylistURL = new System.Collections.ArrayList();
//str = content;
//str = content.Replace('\n', ' ');
//System.Text.RegularExpressions.MatchCollection regexindividualCollecURL = null;
//regexindividualCollecURL = regexindividualURL.Matches(str);
//individualCararraylistURL.Clear();
//individualCararraylistURL.InsertRange(individualCararraylistURL.Count, regexindividualCollecURL);
Regex regexmileageColumn = new Regex("<div class=\"at_infoAndPriceArea at_marginL\">(.*?)</div>");
System.Collections.ArrayList individualCarmileageColumnarraylist = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection regexmileageColumn1 = null;
regexmileageColumn1 = regexmileageColumn.Matches(str);
individualCarmileageColumnarraylist.Clear();
individualCarmileageColumnarraylist.InsertRange(individualCarmileageColumnarraylist.Count, regexmileageColumn1);
for (int x = 0; x < individualCarmileageColumnarraylist.Count; x++)
{
string mainURL = ConfigurationManager.AppSettings["MainUrl_AutoTraders_Ca"].ToString();
string snextURl = individualCarmileageColumnarraylist[x].ToString();
snextURl = snextURl.Substring(snextURl.IndexOf("href="), snextURl.IndexOf("</a>") - snextURl.IndexOf("href="));
snextURl = snextURl.Replace("href=", "");
snextURl=snextURl.Substring(0,snextURl.IndexOf('>'));
//.........这里部分代码省略.........